[webpack-dotenv-plugin] Add type definitions (#18726)

This commit is contained in:
Michael Strobel
2017-08-09 04:52:06 +08:00
committed by Mohamed Hegazy
parent 86e4c7565c
commit 7935e187c6
4 changed files with 64 additions and 0 deletions

22
types/webpack-dotenv-plugin/index.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
// Type definitions for webpack-dotenv-plugin 2.0
// Project: https://github.com/nwinch/webpack-dotenv-plugin#readme
// Definitions by: Michael Strobel <https://github.com/kryops>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import * as webpack from 'webpack';
declare namespace WebpackDotenvPlugin {
interface Options {
path?: string;
sample?: string;
silent?: boolean;
encoding?: string;
allowEmptyValues?: boolean;
}
}
declare class WebpackDotenvPlugin extends webpack.Plugin {
constructor(options?: WebpackDotenvPlugin.Options);
}
export = WebpackDotenvPlugin;

View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"webpack-dotenv-plugin-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -0,0 +1,19 @@
import * as webpack from 'webpack';
import * as DotenvPlugin from 'webpack-dotenv-plugin';
const config: webpack.Configuration = {
plugins: [
new DotenvPlugin(),
new DotenvPlugin({
sample: './.env.default',
path: './.env'
}),
new DotenvPlugin({
sample: './.env.default',
path: './.env',
silent: true,
encoding: 'utf-8',
allowEmptyValues: true
})
]
};