Skip to content

Commit

Permalink
Add TypeScript definition (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
muhashi authored Aug 24, 2024
1 parent ae9fdc4 commit e3315be
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
24 changes: 24 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export type Options = {
/**
Lorem ipsum.
@default rainbows
*/
readonly postfix?: string;
};

/**
My awesome module
@param input - Lorem ipsum.
@returns Lorem ipsum.
@example
```
import unicornFun from 'unicorn-fun';
unicornFun('unicorns');
//=> 'unicorns & rainbows'
```
*/
export default function unicornFun(input: string, options?: Options): string;
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,28 @@
"url": "YOUR WEBSITE"
},
"type": "module",
"exports": "./index.js",
"exports": {
"types": "./index.d.ts",
"default": "./index.js"
},
"sideEffects": false,
"engines": {
"node": ">=18"
},
"scripts": {
"test": "xo && ava"
"test": "xo && ava && tsc index.d.ts"
},
"files": [
"index.js"
"index.js",
"index.d.ts"
],
"keywords": [
"unicorn",
"fun"
],
"dependencies": {},
"devDependencies": {
"ava": "^6.1.3",
"typescript": "^5.5.4",
"xo": "^0.59.3"
}
}

0 comments on commit e3315be

Please sign in to comment.