5

I am using Typescript in Webstorm with Angular 2 and I am frequently getting warnings that a given method can be static. Yes, these specific methods do not depend on the state of the object they are a part of, but there will not be a time when it is used and the object is not instantiated. Should I still make those methods static?

1 Answers1

1

Don't just make the method static. Make it a function.

gardenhead
  • 4,747
  • 2
    Agreed! The only difference between a static method and a free function is the length of the name. If you really want a long name, then just give your function a long name. Putting it a class is pointless. – Daniel T. Sep 23 '16 at 03:02