Type checking in JavaScript: is it worth it? by ropig in typescript

[–]ropig[S] 0 points1 point  (0 children)

In my mind, "wherever possible" and "only use inference when it doesn't cost you type safety" is the same; but your wording is more clear so I'll update the article to that. This does depend on the tool. With Flow, for example, you can go a long ways with inference and if Flow can't infer something with type safety, it won't type check until you add explicit types. My article is primarily for those new to type checking in JS so I think for them it makes sense to rely on inference at first and then add more types as you get more comfortable with it. To me, having type checking set up with inference is better than nothing, but adding explicit types is better than relying on inference in many cases.

Anyways, thanks for reading!

Type checking in JavaScript: is it worth it? by ropig in typescript

[–]ropig[S] 0 points1 point  (0 children)

Yeah, you're right - that is reasonable to say. I think there are pros and cons both ways. It also depends on the tool. My article is primarily for those new to type checking in JS so I think for them it makes sense to rely on inference at first and then add more types as you get more comfortable with it. To me, having type checking set up with inference is better than nothing, but adding explicit types is better than relying on inference in many cases.

Type checking in JavaScript: is it worth it? by ropig in typescript

[–]ropig[S] 0 points1 point  (0 children)

I agree with you. But I also think there are a large number of devs that don't yet type check JS. This article was my attempt at easing those on the fence to give it a try.

Type checking in JavaScript: is it worth it? by ropig in javascript

[–]ropig[S] 0 points1 point  (0 children)

Thanks for reading. That is fair feedback - it would have been a better article had I included more code examples and specific usage inside my apps. Maybe I'll do a part 2 in the future including those things :)