moment: warning and error

description

I use momentjs in my project. There is some questions. momentjsV2.18.1 moment().add("day", 1); moment().add(1, "day"); _008

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 4
  • Comments: 20 (10 by maintainers)

Most upvoted comments

This is described in the docs:

Before version 2.8.0, the moment#add(String, Number) syntax was also supported. It has been deprecated in favor of moment#add(Number, String).

i.e. use moment().add(1, "day");

@icambron Following screenshots are from latest VS Code(1.46.0)

Screen Shot 2020-06-23 at 12 21 36

Screen Shot 2020-06-23 at 12 22 51

I can confirm the same behavior in VS Code 1.39.2: image

@icambron I’m afraid it won’t work. When I change the order of declarations the deprecation warnings remain the same, even after IDE restart. Right click -> Go to -> Declaration always points to the deprecated format.

Deprecated format however gives a warning about type mismatch: image