Skip to content

Commit 4859c92

Browse files
committed
CR comments - remove TS syntax (one last type error)
1 parent b2dd1ee commit 4859c92

File tree

3 files changed

+14
-23
lines changed

3 files changed

+14
-23
lines changed

lib/Chunk.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,8 @@ const ERR_CHUNK_INITIAL =
1818
/** @typedef {import("./ModuleReason.js")} ModuleReason */
1919
/** @typedef {import("webpack-sources").Source} Source */
2020

21-
/** @typedef {(a: Module, b: Module) => -1|0|1} ModuleSortPredicate */
22-
/** @typedef {(m: Module) => boolean} ModuleFilterPredicate */
23-
/** @typedef {(c: Chunk) => boolean} ChunkFilterPredicate */
24-
25-
/**
26-
* @typedef {Object} Identifiable an object who contains an identifier function property
27-
* @property {() => string} identifier the resource or unique identifier of something
28-
*/
29-
3021
/**
31-
* @typedef {Object} WithId an object who has an id property
22+
* @typedef {Object} WithId an object who has an id property *
3223
* @property {string | number} id the id of the object
3324
*/
3425

@@ -71,13 +62,13 @@ const getModulesIdent = set => {
7162

7263
/**
7364
* @template T
74-
* @param {Set<T>} set the set to convert to array
65+
* @param {SortableSet<T>} set the sortable set to convert to array
7566
* @returns {Array<T>} the array returned from Array.from(set)
7667
*/
7768
const getArray = set => Array.from(set);
7869

7970
/**
80-
* @param {Set<Module>} set the Set to get the count/size of
71+
* @param {SortableSet<Module>} set the sortable Set to get the count/size of
8172
* @returns {number} the size of the modules
8273
*/
8374
const getModulesSize = set => {
@@ -111,7 +102,7 @@ class Chunk {
111102
this.entryModule = undefined;
112103
/** @private @type {SortableSet<Module>} */
113104
this._modules = new SortableSet(undefined, sortByIdentifier);
114-
/** @private @type {SortableSet<ChunkGroup | WithId>} */
105+
/** @private @type {SortableSet<ChunkGroup>} */
115106
this._groups = new SortableSet(undefined, sortById);
116107
/** @type {Source[]} */
117108
this.files = [];
@@ -497,14 +488,14 @@ class Chunk {
497488
}
498489

499490
/**
500-
* @param {ModuleSortPredicate=} sortByFn a predicate function used to sort modules
491+
* @param {function(Module, Module): -1|0|1=} sortByFn a predicate function used to sort modules
501492
* @returns {void}
502493
*/
503494
sortModules(sortByFn) {
504495
this._modules.sortWith(sortByFn || sortById);
505496
}
506497

507-
sortItems(sortChunks) {
498+
sortItems() {
508499
this.sortModules();
509500
}
510501

@@ -660,8 +651,8 @@ class Chunk {
660651

661652
/**
662653
*
663-
* @param {ModuleFilterPredicate} filterFn predicate function used to filter modules
664-
* @param {ChunkFilterPredicate} filterChunkFn predicate function used to filter chunks
654+
* @param {function(Module): boolean} filterFn predicate function used to filter modules
655+
* @param {function(Chunk): boolean} filterChunkFn predicate function used to filter chunks
665656
* @returns {boolean} return true if module exists in graph
666657
*/
667658
hasModuleInGraph(filterFn, filterChunkFn) {

lib/ChunkGroup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let debugId = 5000;
1919

2020
/**
2121
* @template T
22-
* @param {Set<T>} set set to convert to array.
22+
* @param {SortableSet<T>} set set to convert to array.
2323
* @returns {T[]} the array format of existing set
2424
*/
2525
const getArray = set => Array.from(set);

lib/util/SortableSet.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class SortableSet extends Set {
1818
this._sortFn = defaultSort;
1919
/** @private @type {(a: T, b: T) => number} | null} */
2020
this._lastActiveSortFn = null;
21-
/** @private @type {Map<Function, T> | undefined} */
21+
/** @private @type {Map<Function, T[]> | undefined} */
2222
this._cache = undefined;
23-
/** @private @type {Map<Function, T> | undefined} */
23+
/** @private @type {Map<Function, T[]|string|number> | undefined} */
2424
this._cacheOrderIndependent = undefined;
2525
}
2626

@@ -79,9 +79,9 @@ class SortableSet extends Set {
7979
this.sortWith(this._sortFn);
8080
}
8181

82-
// eslint-disable-next-line valid-jsdoc
8382
/**
84-
* @param {(instance: SortableSet<T>) => TODO} fn function to calculate value
83+
* Get data from cache
84+
* @param {function(SortableSet<T>): T[]} fn function to calculate value
8585
* @returns {TODO} returns result of fn(this), cached until set changes
8686
*/
8787
getFromCache(fn) {
@@ -99,7 +99,7 @@ class SortableSet extends Set {
9999
}
100100

101101
/**
102-
* @param {Function} fn function to calculate value
102+
* @param {function(SortableSet<T>): string|number|T[]} fn function to calculate value
103103
* @returns {any} returns result of fn(this), cached until set changes
104104
*/
105105
getFromUnorderedCache(fn) {

0 commit comments

Comments
 (0)