Closed patarapolw closed 4 years ago
According to https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-function-d-ts.html, this is as simple as
// ./index.d.ts export = parse /** * convert `str` to ms */ function parse (str: string): number
And, add "typings": "index.d.ts", in your package.json. Then, upload to NPM.
"typings": "index.d.ts"
package.json
Might create a Pull Request later. Hope this package will be actively maintained.
Anyways, for anyone reading this, you can also create declaration.d.ts with
declaration.d.ts
declare module 'parse-duration' { export = parse /** * convert `str` to ms */ function parse (str: string): number }
Any news on this? It would be great to be able to use this with typescript.
Fixed
According to https://www.typescriptlang.org/docs/handbook/declaration-files/templates/module-function-d-ts.html, this is as simple as
And, add
"typings": "index.d.ts"
, in yourpackage.json
. Then, upload to NPM.Might create a Pull Request later. Hope this package will be actively maintained.
Anyways, for anyone reading this, you can also create
declaration.d.ts
with