diff --git a/types/webpack-watched-glob-entries-plugin/index.d.ts b/types/webpack-watched-glob-entries-plugin/index.d.ts new file mode 100644 index 0000000000..6f4c1b4a6a --- /dev/null +++ b/types/webpack-watched-glob-entries-plugin/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for webpack-watched-glob-entries-plugin 2.1 +// Project: https://github.com/Milanzor/webpack-watched-glob-entries-plugin#readme +// Definitions by: Joel Spadin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { IOptions } from 'glob'; +import { EntryFunc, Plugin } from 'webpack'; + +export interface PluginOptions { + basename_as_entry_name?: boolean; +} + +export default class WebpackWatchedGlobEntries extends Plugin { + static getEntries(globs: string[], globOptions?: IOptions, pluginOptions?: PluginOptions): EntryFunc; + static getFiles(globString: string, globOptions?: IOptions, basename_as_entry_name?: boolean): Record; +} diff --git a/types/webpack-watched-glob-entries-plugin/tsconfig.json b/types/webpack-watched-glob-entries-plugin/tsconfig.json new file mode 100644 index 0000000000..20777e1cef --- /dev/null +++ b/types/webpack-watched-glob-entries-plugin/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "webpack-watched-glob-entries-plugin-tests.ts" + ] +} diff --git a/types/webpack-watched-glob-entries-plugin/tslint.json b/types/webpack-watched-glob-entries-plugin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/webpack-watched-glob-entries-plugin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/webpack-watched-glob-entries-plugin/webpack-watched-glob-entries-plugin-tests.ts b/types/webpack-watched-glob-entries-plugin/webpack-watched-glob-entries-plugin-tests.ts new file mode 100644 index 0000000000..1c87b080a1 --- /dev/null +++ b/types/webpack-watched-glob-entries-plugin/webpack-watched-glob-entries-plugin-tests.ts @@ -0,0 +1,29 @@ +import GlobEntriesPlugin from 'webpack-watched-glob-entries-plugin'; + +new GlobEntriesPlugin(); // $ExpectType WebpackWatchedGlobEntries + +GlobEntriesPlugin.getEntries(['']); // $ExpectType EntryFunc + +// $ExpectType EntryFunc +GlobEntriesPlugin.getEntries([''], { + ignore: '' +}); + +// $ExpectType EntryFunc +GlobEntriesPlugin.getEntries([''], { + ignore: '', +}, { + basename_as_entry_name: true, +}); + +GlobEntriesPlugin.getFiles(''); // $ExpectType Record + +// $ExpectType Record +GlobEntriesPlugin.getFiles('', { + ignore: '', +}); + +// $ExpectType Record +GlobEntriesPlugin.getFiles('', { + ignore: '', +}, true);