Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I’m siding with TS on this one. You should type your variables on declaration and not on assignment.
-
Voxera115852yIf it a warning I guess its tslint or prettier or similar and if so you can most likely configure it.
The language has no problem with explicit typing if you want to but some linters/formaters have defaults set to suggest you skip the obvious types to make the code smaller.
But You can usually change which such rules they should apply or not based on team or personal preference.
And yes, such rulesets can often be opinionated ;) -
iiii92192yInferred strong types are better, unless you need a strictly specific type. In which case you should have an explicit call to a converter function in the first place.
There's no clarity in labeling it "number" when it is obviously instantiated as a number
Related Rants
Why is Typescript such a snarky fuck?
a: number = 2;
tYpE Is TrIviAlLy InFeRReD fRoM NuMbeR lItERaL
Shut the fuck up you barely turing complete piece of digital refuse. Why does it bother you so much if I leave the fucking type on for clarity? This is almost as bad as my ex.
rant
typescript