Skip to content

Commit

Permalink
Add TypeScript definition and require Node.js 8 (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
BendingBender authored and sindresorhus committed Jul 21, 2019
1 parent 8f022be commit 0ca4843
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: node_js
node_js:
- '12'
- '10'
- '8'
- '6'
- '4'
6 changes: 6 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {ReadonlyDeep} from 'type-fest';
import globalsJson = require('./globals.json');

declare const globals: ReadonlyDeep<typeof globalsJson>;

export = globals;
7 changes: 7 additions & 0 deletions index.test-d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {expectType, expectError} from 'tsd';
import {ReadonlyDeep} from 'type-fest';
import globals = require('.');

expectType<ReadonlyDeep<{[key: string]: {[key: string]: boolean}}>>(globals);
expectType<boolean>(globals.builtin.Array);
expectError((globals.builtin.Array = true));
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
Expand All @@ -29,13 +29,22 @@
"eslint",
"environments"
],
"dependencies": {
"type-fest": "^0.6.0"
},
"devDependencies": {
"ava": "0.21.0",
"xo": "0.18.0"
"ava": "^2.2.0",
"tsd": "^0.7.2",
"xo": "^0.24.0"
},
"xo": {
"ignores": [
"get-browser-globals.js"
]
},
"tsd": {
"compilerOptions": {
"resolveJsonModule": true
}
}
}

0 comments on commit 0ca4843

Please sign in to comment.