Skip to content

Commit c7f3c58

Browse files
committed
fix(): fix outstanding typewarnings from typeof in Template
1 parent 4d61498 commit c7f3c58

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

lib/Module.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const SortableSet = require("./util/SortableSet");
1212
const Template = require("./Template");
1313

1414
/** @typedef {typeof import("./Chunk")} Chunk */
15-
1615
/** @typedef {typeof import("./RequestShortener")} RequestShortener */
1716

1817
const EMPTY_RESOLVE_OPTIONS = {};
@@ -101,6 +100,9 @@ class Module extends DependenciesBlock {
101100

102101
/** @type {boolean} */
103102
this.useSourceMap = false;
103+
104+
// info from build
105+
this._source = null;
104106
}
105107

106108
get exportsArgument() {

lib/Template.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
/** @typedef {typeof import("./Module")} Module */
6-
/** @typedef {typeof import("./Chunk")} Chunk */
7-
/** @typedef {typeof import("./ModuleTemplate")} ModuleTemplate */
5+
/** @typedef {import("./Module")} Module */
6+
/** @typedef {import("./Chunk")} Chunk */
7+
/** @typedef {import("./ModuleTemplate")} ModuleTemplate */
88
/** @typedef {import("webpack-sources").ConcatSource} ConcatSource */
99

1010
const { ConcatSource } = require("webpack-sources");
11+
const HotUpdateChunk = require("./HotUpdateChunk");
1112

1213
const START_LOWERCASE_ALPHABET_CODE = "a".charCodeAt(0);
1314
const START_UPPERCASE_ALPHABET_CODE = "A".charCodeAt(0);
@@ -204,13 +205,11 @@ class Template {
204205
return arrayOverhead < objectOverhead ? [minId, maxId] : false;
205206
}
206207

207-
//TODO: replace any for Chunk and ModuleTemplate types instead.
208-
//https://github.com/Microsoft/TypeScript/issues/23375
209208
/**
210209
*
211-
* @param {any} chunk chunk whose modules will be rendered
210+
* @param {Chunk} chunk chunk whose modules will be rendered
212211
* @param {ModuleFilterPredicate} filterFn function used to filter modules from chunk to render
213-
* @param {any} moduleTemplate ModuleTemplate instance used to render modules
212+
* @param {ModuleTemplate} moduleTemplate ModuleTemplate instance used to render modules
214213
* @param {any | any[]} dependencyTemplates templates needed for each module to render dependencies
215214
* @param {string=} prefix applying prefix strings
216215
* @return {ConcatSource} rendered chunk modules in a Source object
@@ -225,7 +224,9 @@ class Template {
225224
if (!prefix) prefix = "";
226225
var source = new ConcatSource();
227226
const modules = chunk.getModules().filter(filterFn);
228-
var removedModules = chunk.removedModules;
227+
if (chunk instanceof HotUpdateChunk) {
228+
var removedModules = chunk.removedModules;
229+
}
229230
if (
230231
modules.length === 0 &&
231232
(!removedModules || removedModules.length === 0)

0 commit comments

Comments
 (0)