Skip to content

Commit

Permalink
Merge pull request #137 from chrisblossom/options-partial
Browse files Browse the repository at this point in the history
replace Partial<Options> with explicit optional options
  • Loading branch information
chrisblossom committed May 5, 2019
2 parents 4f8ae44 + 18f71a5 commit 5415087
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/clean-webpack-plugin.ts
Expand Up @@ -8,29 +8,29 @@ export interface Options {
*
* default: false
*/
dry: boolean;
dry?: boolean;

/**
* Write Logs to Console
* (Always enabled when dry is true)
*
* default: false
*/
verbose: boolean;
verbose?: boolean;

/**
* Automatically remove all unused webpack assets on rebuild
*
* default: true
*/
cleanStaleWebpackAssets: boolean;
cleanStaleWebpackAssets?: boolean;

/**
* Do not allow removal of current webpack assets
*
* default: true
*/
protectWebpackAssets: boolean;
protectWebpackAssets?: boolean;

/**
* Removes files once prior to Webpack compilation
Expand All @@ -40,7 +40,7 @@ export interface Options {
*
* default: ['**\/*']
*/
cleanOnceBeforeBuildPatterns: string[];
cleanOnceBeforeBuildPatterns?: string[];

/**
* Removes files after every build (including watch mode) that match this pattern.
Expand All @@ -50,7 +50,7 @@ export interface Options {
*
* default: disabled
*/
cleanAfterEveryBuildPatterns: string[];
cleanAfterEveryBuildPatterns?: string[];

/**
* Allow clean patterns outside of process.cwd()
Expand All @@ -59,7 +59,7 @@ export interface Options {
*
* default: false
*/
dangerouslyAllowCleanPatternsOutsideProject: boolean;
dangerouslyAllowCleanPatternsOutsideProject?: boolean;
}

class CleanWebpackPlugin {
Expand All @@ -74,7 +74,7 @@ class CleanWebpackPlugin {
private initialClean: boolean;
private outputPath: string;

constructor(options: Partial<Options> = {}) {
constructor(options: Options = {}) {
if (typeof options !== 'object' || Array.isArray(options) === true) {
throw new Error(`clean-webpack-plugin only accepts an options object. See:
https://github.com/johnagan/clean-webpack-plugin#options-and-defaults-optional`);
Expand Down

0 comments on commit 5415087

Please sign in to comment.