Skip to content

Commit

Permalink
Add TypeScript definition (#12)
Browse files Browse the repository at this point in the history
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
  • Loading branch information
YS-FE and sindresorhus committed Feb 16, 2020
1 parent df80620 commit 096036c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
19 changes: 19 additions & 0 deletions index.d.ts
@@ -0,0 +1,19 @@
/**
* use typescript
* Fix the $PATH on macOS when run from a GUI app
* @example
* ```
* import fixPath from 'fix-path';
*
* console.log(process.env.PATH);
* //=> '/usr/bin'
*
* fixPath();
*
* console.log(process.env.PATH);
* //=> '/usr/local/bin:/usr/bin'
*
* ```
*/

export default function fixPath(): void;
4 changes: 4 additions & 0 deletions index.test-d.ts
@@ -0,0 +1,4 @@
import {expectType} from 'tsd';
import fixPath from '.';

expectType<void>(fixPath());
9 changes: 6 additions & 3 deletions package.json
Expand Up @@ -13,10 +13,11 @@
"node": ">=8"
},
"scripts": {
"test": "xo && ava"
"test": "xo && ava && tsd"
},
"files": [
"index.js"
"index.js",
"index.d.ts"
],
"keywords": [
"fix",
Expand All @@ -36,6 +37,8 @@
},
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.11.0",
"xo": "^0.24.0"
}
},
"types": "index.d.ts"
}

0 comments on commit 096036c

Please sign in to comment.