Skip to content

TypeScript definition #12

@patarapolw

Description

@patarapolw

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions