Skip to content

Commit f4ceaf5

Browse files
committed
[New] add types
1 parent 641d87c commit f4ceaf5

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

index.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare function isWeakRef<T extends object>(value: unknown): value is WeakRef<T>;
2+
3+
export = isWeakRef;

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ var callBound = require('call-bound');
44

55
var $deref = callBound('WeakRef.prototype.deref', true);
66

7+
/** @type {import('.')} */
78
module.exports = typeof WeakRef === 'undefined'
8-
? function isWeakRef(value) { // eslint-disable-line no-unused-vars
9+
? function isWeakRef(_value) { // eslint-disable-line no-unused-vars
910
return false;
1011
}
1112
: function isWeakRef(value) {

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"prepublishOnly": "safe-publish-latest",
1616
"prepublish": "not-in-publish || npm run prepublishOnly",
1717
"lint": "eslint --ext=js,mjs .",
18+
"postlint": "tsc && attw -P",
1819
"pretest": "npm run lint",
1920
"tests-only": "nyc tape 'test/**/*.js'",
2021
"test": "npm run tests-only",
@@ -41,7 +42,12 @@
4142
},
4243
"homepage": "https://github.com/inspect-js/is-weakref#readme",
4344
"devDependencies": {
45+
"@arethetypeswrong/cli": "^0.17.1",
4446
"@ljharb/eslint-config": "^21.1.1",
47+
"@ljharb/tsconfig": "^0.2.2",
48+
"@types/for-each": "^0.3.3",
49+
"@types/object-inspect": "^1.13.0",
50+
"@types/tape": "^5.6.5",
4551
"auto-changelog": "^2.5.0",
4652
"encoding": "^0.1.13",
4753
"eslint": "=8.8.0",
@@ -51,7 +57,8 @@
5157
"nyc": "^10.3.2",
5258
"object-inspect": "^1.13.3",
5359
"safe-publish-latest": "^2.0.0",
54-
"tape": "^5.9.0"
60+
"tape": "^5.9.0",
61+
"typescript": "next"
5562
},
5663
"dependencies": {
5764
"call-bound": "^1.0.2"

tsconfig.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "@ljharb/tsconfig",
3+
"compilerOptions": {
4+
"target": "ES2021",
5+
},
6+
"exclude": [
7+
"coverage"
8+
]
9+
}

0 commit comments

Comments
 (0)