Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript definition #12

Closed
patarapolw opened this issue Jan 7, 2020 · 2 comments
Closed

TypeScript definition #12

patarapolw opened this issue Jan 7, 2020 · 2 comments

Comments

@patarapolw
Copy link

patarapolw commented Jan 7, 2020

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.

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

declare module 'parse-duration' {
  export = parse

  /**
   * convert `str` to ms
   */
  function parse (str: string): number
}
@rikkegammelmark
Copy link

Any news on this? It would be great to be able to use this with typescript.

@dy
Copy link
Collaborator

dy commented Apr 22, 2020

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants