Skip to content

Commit 296d392

Browse files
BendingBendersindresorhus
authored andcommitted
Refactor TypeScript definition to CommonJS compatible export (#3)
1 parent 4f4f851 commit 296d392

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
export {default} from '@sindresorhus/fnv1a';
1+
import fnv1a = require('@sindresorhus/fnv1a');
2+
3+
export = fnv1a;

index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ const fnv1a = require('@sindresorhus/fnv1a');
44
const stringHash = string => fnv1a(string);
55

66
module.exports = stringHash;
7+
// TODO: remove this in the next major version
78
module.exports.default = stringHash;

index.test-d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {expectType} from 'tsd-check';
2-
import stringHash from '.';
1+
import {expectType} from 'tsd';
2+
import stringHash = require('.');
33

44
expectType<number>(stringHash('🦄🌈'));

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"node": ">=6"
1414
},
1515
"scripts": {
16-
"test": "xo && ava && tsd-check"
16+
"test": "xo && ava && tsd"
1717
},
1818
"files": [
1919
"index.js",
@@ -33,11 +33,11 @@
3333
"function"
3434
],
3535
"dependencies": {
36-
"@sindresorhus/fnv1a": "^1.1.0"
36+
"@sindresorhus/fnv1a": "^1.2.0"
3737
},
3838
"devDependencies": {
39-
"ava": "^1.3.1",
40-
"tsd-check": "^0.5.0",
39+
"ava": "^1.4.1",
40+
"tsd": "^0.7.1",
4141
"xo": "^0.24.0"
4242
}
4343
}

0 commit comments

Comments
 (0)