Skip to content

Commit ed6f65e

Browse files
Merge pull request #269 from FormidableLabs/feature/229-ts-defs
Add TypeScript definitions.
2 parents b74a583 + 408481f commit ed6f65e

File tree

5 files changed

+36
-2
lines changed

5 files changed

+36
-2
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist-*

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
!README.md
99
!package.json
1010
!index.js
11+
!index.d.ts

index.d.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Type definitions for webpack-dashboard 2.x.x
2+
// Project: https://github.com/FormidableLabs/webpack-dashboard
3+
// Definitions by: Parker Ziegler <https://github.com/parkerziegler>
4+
// TypeScript Version: 3.2
5+
6+
declare module 'webpack-dashboard/plugin' {
7+
interface IMessage {
8+
type: string;
9+
value: string | number | { [key: string]: any }
10+
error?: boolean;
11+
}
12+
13+
interface IDashboardOptions {
14+
port?: number;
15+
host?: string;
16+
handler?: (dataArray: IMessage[]) => void;
17+
}
18+
19+
class DashboardPlugin {
20+
constructor(options?: IDashboardOptions);
21+
}
22+
23+
export = DashboardPlugin;
24+
}

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
"engines": {
88
"node": ">=6.0.0"
99
},
10+
"types": "index.d.ts",
1011
"scripts": {
1112
"test": "mocha 'test/**/*.spec.js'",
1213
"test-cov": "nyc mocha 'test/**/*.spec.js'",
1314
"lint": "eslint .",
14-
"check": "npm run lint && npm run test",
15-
"check-ci": "npm run lint && npm run test-cov",
15+
"check": "npm run lint && npm run test && npm run check-ts",
16+
"check-ci": "npm run lint && npm run test-cov && npm run check-ts",
17+
"check-ts": "tsc index.d.ts --noEmit",
1618
"dev": "cross-env EXAMPLE=duplicates-esm node bin/webpack-dashboard.js -- webpack-cli --config examples/config/webpack.config.js --watch"
1719
},
1820
"repository": {
@@ -58,6 +60,7 @@
5860
"nyc": "^11.8.0",
5961
"sinon": "^5.0.7",
6062
"sinon-chai": "^3.0.0",
63+
"typescript": "^3.2.4",
6164
"webpack": "^4.8.3",
6265
"webpack-cli": "^2.1.3",
6366
"webpack-stats-plugin": "^0.2.1"

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6163,6 +6163,11 @@ typedarray@^0.0.6:
61636163
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
61646164
integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=
61656165

6166+
typescript@^3.2.4:
6167+
version "3.2.4"
6168+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.2.4.tgz#c585cb952912263d915b462726ce244ba510ef3d"
6169+
integrity sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg==
6170+
61666171
uglify-es@^3.3.4:
61676172
version "3.3.9"
61686173
resolved "https://registry.yarnpkg.com/uglify-es/-/uglify-es-3.3.9.tgz#0c1c4f0700bed8dbc124cdb304d2592ca203e677"

0 commit comments

Comments
 (0)