You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Typescript has a decent ability to infer types correctly. In some cases, you need to coax it, but that goes for any strongly typed language.
While it is good to be explicit in your typing, I believe that if the linter can infer the type without any help, type annotations should not be added (an argument can also be made for allowing TS to infer return types as well, but I am like half-and-half on this idea). The TS LSP has support for showing inferred types within the editor (with the help of inlay hints or inline virtual text), so requiring type annotations to be present only makes it an extra thing to worry about when developing features.
The text was updated successfully, but these errors were encountered:
Typescript has a decent ability to infer types correctly. In some cases, you need to coax it, but that goes for any strongly typed language.
While it is good to be explicit in your typing, I believe that if the linter can infer the type without any help, type annotations should not be added (an argument can also be made for allowing TS to infer return types as well, but I am like half-and-half on this idea). The TS LSP has support for showing inferred types within the editor (with the help of inlay hints or inline virtual text), so requiring type annotations to be present only makes it an extra thing to worry about when developing features.
The text was updated successfully, but these errors were encountered: