mirror of https://github.com/webpack/webpack.git
refactor: update types (#19834)
This commit is contained in:
parent
e570c1b5d1
commit
e2ded49ee6
|
@ -161,21 +161,14 @@ const moreCount = (list, count) =>
|
||||||
* @template {object} O
|
* @template {object} O
|
||||||
* @template {keyof O} K
|
* @template {keyof O} K
|
||||||
* @template {string} B
|
* @template {string} B
|
||||||
* @typedef {K extends string ? Exclude<O[K], undefined> extends EXPECTED_ANY[] ? never : `${B}.${K}` : never} PropertyName
|
* @typedef {K extends string ? `${B}.${K}` : never} PropertyName
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template {object} O
|
* @template {object} O
|
||||||
* @template {keyof O} K
|
* @template {keyof O} K
|
||||||
* @template {string} B
|
* @template {string} B
|
||||||
* @typedef {K extends string ? NonNullable<O[K]> extends EXPECTED_ANY[] ? `${B}.${K}[]` : never : never} ArrayPropertyName
|
* @typedef {K extends string ? `${B}.${K}[]` : never} ArrayPropertyName
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @template {object} O
|
|
||||||
* @template {keyof O} K
|
|
||||||
* @template {string} B
|
|
||||||
* @typedef {K extends string ? Exclude<O[K], undefined> extends EXPECTED_ANY[] ? `${B}.${K}` : never : never} MultiplePropertyName
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -190,9 +183,7 @@ const moreCount = (list, count) =>
|
||||||
* @template {string} B
|
* @template {string} B
|
||||||
* @template {string} [R=B]
|
* @template {string} [R=B]
|
||||||
* @typedef {{ [K in keyof O as PropertyName<O, K, B>]?: SimplePrinter<O[K], R> } &
|
* @typedef {{ [K in keyof O as PropertyName<O, K, B>]?: SimplePrinter<O[K], R> } &
|
||||||
* { [K in keyof O as ArrayPropertyName<O, K, B>]?: Exclude<O[K], undefined> extends (infer I)[] ? SimplePrinter<I, R> : never } &
|
* { [K in keyof O as ArrayPropertyName<O, K, B>]?: Exclude<O[K], undefined> extends (infer I)[] ? SimplePrinter<I, R> : never }} Printers
|
||||||
* { [K in keyof O as MultiplePropertyName<O, K, B>]?: SimplePrinter<O[K], R> }
|
|
||||||
* } Printers
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1463,7 +1454,7 @@ const AVAILABLE_COLORS = {
|
||||||
* @typedef {T extends [infer Head, ...infer Tail] ? Tail : undefined} Tail
|
* @typedef {T extends [infer Head, ...infer Tail] ? Tail : undefined} Tail
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @typedef {Required<{ [Key in keyof KnownStatsPrinterFormatters]: (value: Parameters<NonNullable<KnownStatsPrinterFormatters[Key]>>[0], options: Required<KnownStatsPrinterColorFunctions> & StatsPrinterContextWithExtra, ...args: Tail<Parameters<NonNullable<KnownStatsPrinterFormatters[Key]>>>) => string }>} AvailableFormats */
|
/** @typedef {{ [Key in keyof KnownStatsPrinterFormatters]: (value: Parameters<NonNullable<KnownStatsPrinterFormatters[Key]>>[0], options: Required<KnownStatsPrinterColorFunctions> & StatsPrinterContextWithExtra, ...args: Tail<Parameters<NonNullable<KnownStatsPrinterFormatters[Key]>>>) => string }} AvailableFormats */
|
||||||
|
|
||||||
/** @type {AvailableFormats} */
|
/** @type {AvailableFormats} */
|
||||||
const AVAILABLE_FORMATS = {
|
const AVAILABLE_FORMATS = {
|
||||||
|
@ -1877,10 +1868,10 @@ class DefaultStatsPrinterPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(SIMPLE_ELEMENT_JOINERS)) {
|
for (const key of Object.keys(SIMPLE_ELEMENT_JOINERS)) {
|
||||||
const joiner = SIMPLE_ELEMENT_JOINERS[key];
|
const joiner =
|
||||||
stats.hooks.printElements
|
/** @type {(items: Item[], context: StatsPrinterContext) => string} */
|
||||||
.for(key)
|
(SIMPLE_ELEMENT_JOINERS[key]);
|
||||||
.tap(PLUGIN_NAME, /** @type {TODO} */ (joiner));
|
stats.hooks.printElements.for(key).tap(PLUGIN_NAME, joiner);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(RESULT_MODIFIER)) {
|
for (const key of Object.keys(RESULT_MODIFIER)) {
|
||||||
|
|
Loading…
Reference in New Issue