DEV Community

Discussion on: Inventing your own HTML Elements to build a DOM game

Collapse
 
eerk profile image
eerk • Edited

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;
Enter fullscreen mode Exit fullscreen mode

Now we know that sooner or later test will be used to store a Person.

Collapse
 
mapleleaf profile image
MapleLeaf

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 😊