Skip to content

Commit

Permalink
fix some internal types
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Apr 22, 2021
1 parent e42915c commit 7cc4078
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lib/Compilation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion lib/EntryPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion lib/NormalModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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")
);
Expand Down
2 changes: 1 addition & 1 deletion lib/SourceMapDevToolPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 */

/**
Expand Down
10 changes: 5 additions & 5 deletions types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1648,8 +1648,8 @@ declare class Compilation {
*/
createChildCompiler(
name: string,
outputOptions: OutputNormalized,
plugins: (
outputOptions?: OutputNormalized,
plugins?: (
| ((this: Compiler, compiler: Compiler) => void)
| WebpackPluginInstance
)[]
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7cc4078

Please sign in to comment.