3 ms·
> 1 - Work-arounds for interoperability with non typescript / legacy third party dependencies. (issue: ugly, non consistent code) These "workarounds" are typic
by bilalq 5y ago
> 1 - Work-arounds for interoperability with non typescript / legacy third party dependencies. (issue: ugly, non consistent code)
These "workarounds" are typically to use third-party or hand-rolled type defs. The other common case is to write and use typeguard functions that do runtime type checking but can contextually narrow types inside conditional blocks that use them. It's a little extra work, but the ROI is there, in my experience.
> 2 - Turn off strict type checking due to third party component compatibility. (issue: isn't the purpose of typescript type checking?)
I've never seen this done. I'd always take one of the approaches I mentioned above.
> 3 - Is type checking really needed for most applications? (assuming some flavor of CRUD with the occasional special sauce). (issue: seems a bit academic unless your working on a webapp for the mars rover)
The productivity gains alone make it worth it, IMO. Refactoring without worry that you forgot to maybe update one place is just so freeing. Amazing auto-complete and intellisense makes it so much easier to work with third party libs you're unfamiliar with. And the best part is of course that many simple mistakes get caught before you even run your code at all. It takes me less time to write TS code than it does to write the equivalent JS in even simple projects. A higher likelihood of writing correct code is valuable in just about any setting, not just space projects.
- dnndev 5y agoI am glad to hear your more productive in TS. Personally takes me longer to keep all my proper interfaces and models up to date than rename variables (which does not happen all that often that is out of the scope of a function or let alone a file.)
- bilalq 5y agoYour interfaces rarely change in isolation though, right? If they're changing, so are a lot of the places you're interacting with the fields of objects of those types. A "Refactor>Rename Symbol" flow on the interface field would also update all places you used it. I think it may take a little bit of time for things to "click", but once they do, it's usually much faster/easier/safer to work in TS.