fix some internal types

This commit is contained in:
Tobias Koppers 2021-04-22 21:43:43 +02:00
parent e42915cf49
commit 7cc40782b7
6 changed files with 14 additions and 12 deletions

View File

@ -3963,8 +3963,8 @@ This prevents using hashes of each other and should be avoided.`);
* from parent (or top level compiler) and creates a child Compilation
*
* @param {string} name name of the child compiler
* @param {OutputOptions} outputOptions // Need to convert config schema to types for this
* @param {Array<WebpackPluginInstance | WebpackPluginFunction>} plugins webpack plugins that will be applied
* @param {OutputOptions=} outputOptions // Need to convert config schema to types for this
* @param {Array<WebpackPluginInstance | WebpackPluginFunction>=} plugins webpack plugins that will be applied
* @returns {Compiler} creates a child Compiler instance
*/
createChildCompiler(name, outputOptions, plugins) {

View File

@ -917,8 +917,8 @@ ${other}`);
* @param {Compilation} compilation the compilation
* @param {string} compilerName the compiler's name
* @param {number} compilerIndex the compiler's index
* @param {OutputOptions} outputOptions the output options
* @param {WebpackPluginInstance[]} plugins the plugins to apply
* @param {OutputOptions=} outputOptions the output options
* @param {WebpackPluginInstance[]=} plugins the plugins to apply
* @returns {Compiler} a child compiler
*/
createChildCompiler(

View File

@ -17,7 +17,7 @@ class EntryPlugin {
*
* @param {string} context context path
* @param {string} entry entry path
* @param {EntryOptions | string} options entry options (passing a string is deprecated)
* @param {EntryOptions | string=} options entry options (passing a string is deprecated)
*/
constructor(context, entry, options) {
this.context = context;

View File

@ -42,7 +42,7 @@ const { contextify, absolutify } = require("./util/identifier");
const makeSerializable = require("./util/makeSerializable");
const memoize = require("./util/memoize");
/** @typedef {import("source-map").RawSourceMap} SourceMap */
/** @typedef {import("source-map").RawSourceMap} RawSourceMap */
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../declarations/LoaderContext").NormalModuleLoaderContext} NormalModuleLoaderContext */
/** @typedef {import("../declarations/WebpackOptions").Mode} Mode */
@ -69,6 +69,8 @@ const memoize = require("./util/memoize");
/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/** @typedef {Omit<RawSourceMap, "version"> & { version: number }} SourceMap */
const getInvalidDependenciesModuleWarning = memoize(() =>
require("./InvalidDependenciesModuleWarning")
);

View File

@ -18,7 +18,6 @@ const { absolutify } = require("./util/identifier");
const schema = require("../schemas/plugins/SourceMapDevToolPlugin.json");
/** @typedef {import("source-map").RawSourceMap} SourceMap */
/** @typedef {import("webpack-sources").MapOptions} MapOptions */
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */
@ -28,6 +27,7 @@ const schema = require("../schemas/plugins/SourceMapDevToolPlugin.json");
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./NormalModule").SourceMap} SourceMap */
/** @typedef {import("./util/Hash")} Hash */
/**

10
types.d.ts vendored
View File

@ -1648,8 +1648,8 @@ declare class Compilation {
*/
createChildCompiler(
name: string,
outputOptions: OutputNormalized,
plugins: (
outputOptions?: OutputNormalized,
plugins?: (
| ((this: Compiler, compiler: Compiler) => void)
| WebpackPluginInstance
)[]
@ -1853,8 +1853,8 @@ declare class Compiler {
compilation: Compilation,
compilerName: string,
compilerIndex: number,
outputOptions: OutputNormalized,
plugins: WebpackPluginInstance[]
outputOptions?: OutputNormalized,
plugins?: WebpackPluginInstance[]
): Compiler;
isChild(): boolean;
createCompilation(): Compilation;
@ -3033,7 +3033,7 @@ declare class EntryPlugin {
* An entry plugin which will handle
* creation of the EntryDependency
*/
constructor(context: string, entry: string, options: string | EntryOptions);
constructor(context: string, entry: string, options?: string | EntryOptions);
context: string;
entry: string;
options: string | EntryOptions;