4 ms·
I'm a big TypeScript fan but at times it just doesn't work & needs to be ignored. Like all things, you get to a point when you know what rules are okay to ignor
by mattferderer 9y ago
I'm a big TypeScript fan but at times it just doesn't work & needs to be ignored. Like all things, you get to a point when you know what rules are okay to ignore. You can't do default props in React very nicely for example. Functional programming like pipes can also be a pain.
That said, TypeScript (and Flow) offers other huge benefits than the 15% of bugs mentioned.
* Improved documentation
* Better code hinting in the editor & better editor experience
* Teaches better JavaScript & prevents browser bugs. Some browsers are very forgiving when you incorrectly use JavaScript with DOM elements. Others are not.
Types slow down beginners a lot but that's a good thing. When learning a new language, a type system can act like a pair programmer or a teacher helping guide you in learning the types of the language. Each type has things you can & cannot do. People who learned JavaScript using JQuery & then try to type JavaScript without JQuery run into many of these issues. After using types for a while, the time investment is very minimal especially compared with having to come back & find the error later.
- bpicolo 9y agoDoesn't seem overly tricky? https://stackoverflow.com/questions/37282159/default-property-value-in-react-component-using-typescript https://stackoverflow.com/questions/37282159/default-propert...
- mattferderer 9y agoI've done that method & maybe I've missed something but I get a ton of "object is possibly undefined" warnings then.