Thanks! I added strict to tsconfig :) I still like to manually declare the type, it's more readable to me. It also tells other devs what your intention is with this variable.
const test:Person;
Now we know that sooner or later test will be used to store a Person.
Definitely helps readability, yeah. But any good modern editor will still tell you the type of the variable/function/method on hover as well.
Plus, const variables need an initial value anyway, but even if you use let instead, having an initial value helps to avoid those nasty undefined errors as well 😊
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.
Thanks! I added
strict
to tsconfig :) I still like to manually declare the type, it's more readable to me. It also tells other devs what your intention is with this variable.Now we know that sooner or later
test
will be used to store aPerson
.Definitely helps readability, yeah. But any good modern editor will still tell you the type of the variable/function/method on hover as well.
Plus, const variables need an initial value anyway, but even if you use
let
instead, having an initial value helps to avoid those nasty undefined errors as well 😊