mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-01 07:40:10 +00:00
Improve license-checker-webpack-plugin definitions (#34282)
* Add types for license-checker-webpack-plugin * Improve license-checker-webpack-plugin definitions Make options parameter optional. The module documentation does not state whether this parameter is or is not intended to be optional, but the code allows for it. Use Partial<Options> instead of interface with all optional fields.
This commit is contained in:
16
types/license-checker-webpack-plugin/index.d.ts
vendored
16
types/license-checker-webpack-plugin/index.d.ts
vendored
@@ -7,7 +7,7 @@
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
declare class LicenseCheckerWebpackPlugin extends Plugin {
|
||||
constructor(options: LicenseCheckerWebpackPlugin.Options);
|
||||
constructor(options?: Partial<LicenseCheckerWebpackPlugin.Options>);
|
||||
}
|
||||
|
||||
declare namespace LicenseCheckerWebpackPlugin {
|
||||
@@ -23,14 +23,14 @@ declare namespace LicenseCheckerWebpackPlugin {
|
||||
/**
|
||||
* Regular expression that matches the file paths of dependencies to check.
|
||||
*/
|
||||
filter?: RegExp;
|
||||
filter: RegExp;
|
||||
|
||||
/**
|
||||
* SPDX expression with allowed licenses.
|
||||
*
|
||||
* Default: `"(Apache-2.0 OR BSD-2-Clause OR BSD-3-Clause OR MIT)"`
|
||||
*/
|
||||
allow?: string;
|
||||
allow: string;
|
||||
|
||||
/**
|
||||
* Array of dependencies to ignore, in the format `["<dependency name>@<version range>"]`.
|
||||
@@ -38,7 +38,7 @@ declare namespace LicenseCheckerWebpackPlugin {
|
||||
*
|
||||
* Default: `[]`
|
||||
*/
|
||||
ignore?: string[];
|
||||
ignore: string[];
|
||||
|
||||
/**
|
||||
* Object of dependencies to override, in the format `{"<dependency name>@<version range>": { ... }}`.
|
||||
@@ -46,27 +46,27 @@ declare namespace LicenseCheckerWebpackPlugin {
|
||||
*
|
||||
* Default: `{}`
|
||||
*/
|
||||
override?: Record<string, Partial<Dependency>>;
|
||||
override: Record<string, Partial<Dependency>>;
|
||||
|
||||
/**
|
||||
* Whether to emit errors instead of warnings.
|
||||
*
|
||||
* Default: `false`
|
||||
*/
|
||||
emitError?: boolean;
|
||||
emitError: boolean;
|
||||
|
||||
/**
|
||||
* Path to a `.ejs` template, or function that will generate the contents
|
||||
* of the third-party notices file.
|
||||
*/
|
||||
outputWriter?: string | ((dependencies: Dependency[]) => string);
|
||||
outputWriter: string | ((dependencies: Dependency[]) => string);
|
||||
|
||||
/**
|
||||
* Name of the third-party notices file with all licensing information.
|
||||
*
|
||||
* Default: `"ThirdPartyNotices.txt"`
|
||||
*/
|
||||
outputFilename?: string;
|
||||
outputFilename: string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,3 +22,6 @@ new LicenseCheckerWebpackPlugin({
|
||||
return dependencies.map(d => `${d.name} ${d.licenseName}`).join('\n');
|
||||
},
|
||||
});
|
||||
|
||||
// $ExpectType LicenseCheckerWebpackPlugin
|
||||
new LicenseCheckerWebpackPlugin();
|
||||
|
||||
Reference in New Issue
Block a user