Skip to content

Commit 6451833

Browse files
committed
refactor: add type annotations
1 parent c10b21b commit 6451833

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

Diff for: src/index.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,12 @@ class MiniCssExtractPlugin {
845845

846846
return obj;
847847
};
848-
// @ts-ignore
848+
849+
/**
850+
* @param {Chunk} chunk chunk
851+
* @param {ChunkGraph} chunkGraph chunk graph
852+
* @returns {boolean} true, when the chunk has css
853+
*/
849854
function chunkHasCss(chunk, chunkGraph) {
850855
// this function replace:
851856
// const chunkHasCss = require("webpack/lib/css/CssModulesPlugin").chunkHasCss;
@@ -884,13 +889,12 @@ class MiniCssExtractPlugin {
884889
/** @type {Chunk} */ (chunk),
885890
/** @type {Compilation} */ (this.compilation)
886891
);
887-
const globalObject = runtimeTemplate.globalObject;
892+
const { globalObject } = runtimeTemplate;
888893
const { linkPreload, linkPrefetch } =
889894
JsonpChunkLoadingRuntimeModule.getCompilationHooks(compilation);
890-
const conditionMap = chunkGraph.getChunkConditionMap(
891-
chunk,
892-
chunkHasCss
893-
);
895+
const conditionMap = /** @type {ChunkGraph} */ (
896+
chunkGraph
897+
).getChunkConditionMap(/** @type {Chunk} */ (chunk), chunkHasCss);
894898
const hasCssMatcher = compileBooleanMatcher(conditionMap);
895899

896900
const withLoading =

0 commit comments

Comments
 (0)