My rule is that a functions' input and output should always be typed, even if it can be guessed. This to avoid mistakes when you refactor that function.
And to type anything that the compiler can't guess, like getElementById or JSON.parse. Often type it to unknown and write type guards. Anything else shouldn't be typed. You should never need to type already known types to unknown and back to a different type. You should never need to type to any except as a temporary fix for old code.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
This was a great article, but I don't think typing a variable which the compiler can guess its a good idea...
Can you be specific about which lines this comment pertains to in the final repository?
My rule is that a functions' input and output should always be typed, even if it can be guessed. This to avoid mistakes when you refactor that function.
And to type anything that the compiler can't guess, like
getElementById
or JSON.parse. Often type it tounknown
and write type guards. Anything else shouldn't be typed. You should never need to type already known types tounknown
and back to a different type. You should never need to type toany
except as a temporary fix for old code.