How to use moment-duration-format in TypeScript?

前端 未结 4 1216
忘掉有多难
忘掉有多难 2021-02-19 06:00

I am using moment.js in my TypeScript (Ionic2/Angular2) project. Following on from this post, I now want to try out a plugin moment-duration-format

I have the npm packag

4条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-19 06:14

    I'm having the same problem...

    It seems as if there is an error in the type definition. Others have same issue as you can see here: https://github.com/souldreamer/noti-cli/blob/ef104c22792e0dfeb67d3372b04e231d45ffaa55/src/shared/pipes.ts#L38

    There was a fix for the problem as part of a pull request on github, that unfortunately has been closed without merging: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/14327

    As a temporary workaround, you could use the line of code of the first link. As second step we should try to create a new pull request on github, to get the problem fixed in future releases.

提交回复
热议问题