mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
feat(webpack-error-notification): definition files (#42517)
- type definitions - tests https://github.com/vsolovyov/webpack-error-notification#usage Thanks!
This commit is contained in:
parent
14ce63d3bf
commit
0a07cb89a2
30
types/webpack-error-notification/index.d.ts
vendored
Normal file
30
types/webpack-error-notification/index.d.ts
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
// Type definitions for webpack-error-notification 0.1
|
||||
// Project: https://github.com/vsolovyov/webpack-error-notification#readme
|
||||
// Definitions by: Piotr Błażejewicz (Peter Blazejewicz) <https://github.com/peterblazejewicz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Plugin, Stats } from 'webpack';
|
||||
|
||||
declare class WebpackErrorNotificationPlugin extends Plugin {
|
||||
/**
|
||||
* You can supply some strategy for the plugin to display notification.
|
||||
* If you don't supply anything, it will use process.platform as a strategy name.
|
||||
* `darwin` and `linux` are supported out of the box now.
|
||||
* You can also supply function(msg) {} as a strategy that will use your notification CLI tool of choice.
|
||||
*/
|
||||
constructor(strategy?: WebpackErrorNotificationPlugin.Strategy, options?: WebpackErrorNotificationPlugin.Options);
|
||||
|
||||
compileMessage(stats: Stats): string;
|
||||
compilationDone(stats: Stats): void;
|
||||
}
|
||||
|
||||
declare namespace WebpackErrorNotificationPlugin {
|
||||
type Strategy = 'darwin' | 'linux' | ((msg: string) => void);
|
||||
|
||||
interface Options {
|
||||
/** if you do not want to notify warnings, set this to `false` */
|
||||
notifyWarnings?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export = WebpackErrorNotificationPlugin;
|
||||
23
types/webpack-error-notification/tsconfig.json
Normal file
23
types/webpack-error-notification/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"webpack-error-notification-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/webpack-error-notification/tslint.json
Normal file
1
types/webpack-error-notification/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@ -0,0 +1,43 @@
|
||||
import WebpackErrorNotificationPlugin = require('webpack-error-notification');
|
||||
import webpack = require('webpack');
|
||||
|
||||
let config: webpack.Configuration = {
|
||||
plugins: [
|
||||
// defaults
|
||||
new WebpackErrorNotificationPlugin(),
|
||||
],
|
||||
};
|
||||
|
||||
config = {
|
||||
plugins: [new WebpackErrorNotificationPlugin('darwin')],
|
||||
};
|
||||
config = {
|
||||
plugins: [
|
||||
new WebpackErrorNotificationPlugin('darwin', {
|
||||
notifyWarnings: false,
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
config = {
|
||||
plugins: [
|
||||
new WebpackErrorNotificationPlugin('linux', {
|
||||
notifyWarnings: false,
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
const customStrategy: WebpackErrorNotificationPlugin.Strategy = (msg: string) => {
|
||||
// todo
|
||||
};
|
||||
|
||||
config = {
|
||||
plugins: [new WebpackErrorNotificationPlugin(customStrategy)],
|
||||
};
|
||||
config = {
|
||||
plugins: [
|
||||
new WebpackErrorNotificationPlugin(customStrategy, {
|
||||
notifyWarnings: false,
|
||||
}),
|
||||
],
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user