1

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

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

  • 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 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.