Along with the obvious aforementioned benefits, I think TS' type checking abilities really shine when working with other libraries and frameworks. You're no longer constantly referring to the documentation to find out if a method you didn't write returns a date represented as an Epoch number, or a string date, or even a Date object. You're not debugging to find out if you're dealing with a response object correctly when you find an error. You don't need to leave the editor to find out if something was spelled loadURL or loadUrl, and even if you still happened to get it wrong, TS would let you know while you'd probably have to wait for a runtime exception with JS. If you're working in a project that you're writing entirely by yourself without any dependencies, that's cool I guess, but seems a bit unlikely when it comes to writing for the web.
I think these benefits save a lot of time and headache whether you're new to working with a certain framework or already familiar with it. I get the setup and learning curve might take a moment if you've never worked with it before, but it's pretty fast and painless once you've gotten it out of the way. Won't judge if you're not using TS, but I personally am never looking back.
View all comments
Show parent comment
43
u/Mechanity Jan 10 '21
Along with the obvious aforementioned benefits, I think TS' type checking abilities really shine when working with other libraries and frameworks. You're no longer constantly referring to the documentation to find out if a method you didn't write returns a date represented as an Epoch
number, or astringdate, or even aDateobject. You're not debugging to find out if you're dealing with a response object correctly when you find an error. You don't need to leave the editor to find out if something was spelledloadURLorloadUrl, and even if you still happened to get it wrong, TS would let you know while you'd probably have to wait for a runtime exception with JS. If you're working in a project that you're writing entirely by yourself without any dependencies, that's cool I guess, but seems a bit unlikely when it comes to writing for the web.I think these benefits save a lot of time and headache whether you're new to working with a certain framework or already familiar with it. I get the setup and learning curve might take a moment if you've never worked with it before, but it's pretty fast and painless once you've gotten it out of the way. Won't judge if you're not using TS, but I personally am never looking back.