Skip to content

Commit

Permalink
typescript (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
doichev-kostia committed Oct 27, 2023
1 parent 4970782 commit 27c95d9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
11 changes: 8 additions & 3 deletions package.json
Expand Up @@ -3,15 +3,18 @@
"version": "1.0.3",
"description": "Reuse objects and functions with style",
"main": "reusify.js",
"types": "reusify.d.ts",
"scripts": {
"lint": "standard",
"test": "tape test.js | faucet",
"istanbul": "istanbul cover tape test.js",
"coverage": "npm run istanbul; cat coverage/lcov.info | coveralls"
"coverage": "npm run istanbul; cat coverage/lcov.info | coveralls",
"test:typescript": "tsc"
},
"pre-commit": [
"lint",
"test"
"test",
"test:typescript"
],
"repository": {
"type": "git",
Expand All @@ -35,11 +38,13 @@
"iojs": ">=1.0.0"
},
"devDependencies": {
"@types/node": "^20.1.0",
"coveralls": "^2.13.3",
"faucet": "0.0.1",
"istanbul": "^0.4.5",
"pre-commit": "^1.2.2",
"standard": "^10.0.3",
"tape": "^4.8.0"
"tape": "^4.8.0",
"typescript": "^5.2.2"
}
}
14 changes: 14 additions & 0 deletions reusify.d.ts
@@ -0,0 +1,14 @@
interface Node {
next: Node | null;
}

interface Constructor<T> {
new(): T;
}

declare function reusify<T extends Node>(constructor: Constructor<T>): {
get(): T;
release(node: T): void;
};

export = reusify;
11 changes: 11 additions & 0 deletions tsconfig.json
@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"noEmit": true,
"strict": true
},
"files": [
"./reusify.d.ts"
]
}

0 comments on commit 27c95d9

Please sign in to comment.