mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
add worker-plugin types (#41223)
This commit is contained in:
committed by
Andrew Branch
parent
a9fd0c12aa
commit
97f91edc4d
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// Type definitions for worker-plugin 3.2
|
||||
// Project: https://github.com/GoogleChromeLabs/worker-plugin
|
||||
// Definitions by: Artur Androsovych <https://github.com/arturovt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as webpack from 'webpack';
|
||||
|
||||
export = WorkerPlugin;
|
||||
|
||||
declare class WorkerPlugin extends webpack.Plugin {
|
||||
constructor(options?: WorkerPlugin.Options);
|
||||
}
|
||||
|
||||
declare namespace WorkerPlugin {
|
||||
interface Options {
|
||||
globalObject?: boolean | string;
|
||||
plugins?: Array<string | webpack.Plugin>;
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
"worker-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import WorkerPlugin = require('worker-plugin');
|
||||
import webpack = require('webpack');
|
||||
|
||||
new WorkerPlugin();
|
||||
|
||||
class ExistingPlugin extends webpack.Plugin {}
|
||||
|
||||
const optionsArray: WorkerPlugin.Options[] = [
|
||||
{
|
||||
globalObject: false,
|
||||
},
|
||||
{
|
||||
globalObject: 'self',
|
||||
},
|
||||
{
|
||||
plugins: [
|
||||
'SomeExistingPlugin',
|
||||
new ExistingPlugin(),
|
||||
],
|
||||
}
|
||||
];
|
||||
|
||||
const plugins = optionsArray.map(options => new WorkerPlugin(options));
|
||||
Reference in New Issue
Block a user