From f8fe502c5135fc97dde18c2bd41eadf47318bc02 Mon Sep 17 00:00:00 2001 From: Max Boguslavsky <521205+maxbogus@users.noreply.github.com> Date: Sat, 13 Jul 2019 00:50:28 +0300 Subject: [PATCH] Updated definition of type for case-sensitive-paths-webpack-plugin (#36830) * updated definition * added test * fixed error * reverted changes not related to pull request --- .../case-sensitive-paths-webpack-plugin-tests.ts | 9 +++++++-- types/case-sensitive-paths-webpack-plugin/index.d.ts | 4 +++- types/html-webpack-plugin/index.d.ts | 6 ++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/types/case-sensitive-paths-webpack-plugin/case-sensitive-paths-webpack-plugin-tests.ts b/types/case-sensitive-paths-webpack-plugin/case-sensitive-paths-webpack-plugin-tests.ts index a4370cff73..2c09b7e3c9 100644 --- a/types/case-sensitive-paths-webpack-plugin/case-sensitive-paths-webpack-plugin-tests.ts +++ b/types/case-sensitive-paths-webpack-plugin/case-sensitive-paths-webpack-plugin-tests.ts @@ -1,15 +1,20 @@ -import { Configuration } from 'webpack'; +import { Compiler, Configuration, Plugin } from 'webpack'; import CaseSensitivePathsWebpackPlugin = require('case-sensitive-paths-webpack-plugin'); const options: CaseSensitivePathsWebpackPlugin.Options = { debug: true, }; +const compiler: Compiler = new Compiler(); +const plugin: Plugin = new CaseSensitivePathsWebpackPlugin(); + +plugin.apply(compiler); const c: Configuration = { plugins: [ new CaseSensitivePathsWebpackPlugin(), new CaseSensitivePathsWebpackPlugin({ - debug: true + debug: true, }), + plugin, ], }; diff --git a/types/case-sensitive-paths-webpack-plugin/index.d.ts b/types/case-sensitive-paths-webpack-plugin/index.d.ts index 58cdccf25f..208766a904 100644 --- a/types/case-sensitive-paths-webpack-plugin/index.d.ts +++ b/types/case-sensitive-paths-webpack-plugin/index.d.ts @@ -4,12 +4,14 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import { Plugin } from 'webpack'; +import { Plugin, Compiler } from 'webpack'; export = CaseSensitivePathsWebpackPlugin; declare class CaseSensitivePathsWebpackPlugin extends Plugin { constructor(options?: CaseSensitivePathsWebpackPlugin.Options); + + apply(compiler: Compiler): void; } declare namespace CaseSensitivePathsWebpackPlugin { diff --git a/types/html-webpack-plugin/index.d.ts b/types/html-webpack-plugin/index.d.ts index 25b615a7be..090e4c5323 100644 --- a/types/html-webpack-plugin/index.d.ts +++ b/types/html-webpack-plugin/index.d.ts @@ -6,14 +6,16 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -import { Plugin, compilation } from 'webpack'; +import { Plugin, compilation, Compiler } from 'webpack'; import { AsyncSeriesWaterfallHook } from 'tapable'; import { Options as HtmlMinifierOptions } from 'html-minifier'; export = HtmlWebpackPlugin; declare class HtmlWebpackPlugin extends Plugin { - constructor(options?: HtmlWebpackPlugin.Options); + constructor(options?: HtmlWebpackPlugin.Options); + + apply(compiler: Compiler): void; } declare namespace HtmlWebpackPlugin {