Skip to content

Commit

Permalink
Merge pull request #11948 from jantimon/fix/plugin-types
Browse files Browse the repository at this point in the history
fixes "Type '(compiler: Compiler) => void' is not assignable to type '() => void'.ts"
  • Loading branch information
sokra committed Nov 26, 2020
2 parents fd056e2 + d12b043 commit eb5481a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
9 changes: 3 additions & 6 deletions lib/Compilation.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ const { getRuntimeKey } = require("./util/runtime");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */
/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */
/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
/** @typedef {import("./Cache")} Cache */
/** @typedef {import("./CacheFacade")} CacheFacade */
Expand Down Expand Up @@ -115,11 +117,6 @@ const { getRuntimeKey } = require("./util/runtime");
* @returns {any}
*/

/**
* @typedef {Object} Plugin
* @property {() => void} apply
*/

/** @typedef {new (...args: any[]) => Dependency} DepConstructor */
/** @typedef {Record<string, Source>} CompilationAssets */

Expand Down Expand Up @@ -3321,7 +3318,7 @@ This prevents using hashes of each other and should be avoided.`
*
* @param {string} name name of the child compiler
* @param {OutputOptions} outputOptions // Need to convert config schema to types for this
* @param {Plugin[]} plugins webpack plugins that will be applied
* @param {Array<WebpackPluginInstance | WebpackPluginFunction>} plugins webpack plugins that will be applied
* @returns {Compiler} creates a child Compiler instance
*/
createChildCompiler(name, outputOptions, plugins) {
Expand Down
8 changes: 4 additions & 4 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,10 @@ declare class Compilation {
createChildCompiler(
name: string,
outputOptions: OutputNormalized,
plugins: Plugin[]
plugins: (
| ((this: Compiler, compiler: Compiler) => void)
| WebpackPluginInstance
)[]
): Compiler;
checkConstraints(): void;

Expand Down Expand Up @@ -6663,9 +6666,6 @@ declare interface PerformanceOptions {
*/
maxEntrypointSize?: number;
}
declare interface Plugin {
apply: () => void;
}
declare interface PnpApiImpl {
resolveToUnqualified: (arg0: string, arg1: string, arg2?: any) => string;
}
Expand Down

0 comments on commit eb5481a

Please sign in to comment.