Yes. It's been suggested that programmers are biased towards static type systems because they present interesting puzzles, and we like puzzles, even if they come at the expense of productivity. I don't want to agree with that, but I can't deny there's some truth to it.
Yeah. I learnt to use @ts-ignore but there are some religious people who judge quality of code by the coverage of how typed something is even if it is not necessarily benefiting.
Example: one or two requests to an isolated rest API with some data. While I get the point of documenting the properties if you don't use all of them and might need to in future, most of the time - it's not necessary. I have seen some people include a type generator for this.
or including complex generic mess. I myself am guilty of this one. A recent example comes to mind where I wanted to generate a multi dimensional array from an external api. Each entry in it would have specific first items and rest would be some complex typefoo.
I spent half an hour on writing the type. The thing is it's an isolated code and there is no one other than me working on it. Plus, there is visible code doing transformation of the data to turn it into specific entries. It's just kind of not necessary and the type isn't readable either.
Something like that with imported types from another file.
I think it's easy to read types for someone coming into the project. I can hover over and see how it would look like if the case is not isolated.
Another thing that makes typescript type system alluring is that it's like an entirely different language due to javascript being so dynamic. It's similar to writing coq or some proof theorem language to verify the code. In this case, it's more data structures or data itself.
Maybe it's more similar to writing your own linter or subset of language by putting constraints through the type system [0]. I am not sure.
I just found about and have been reaching for this type generator when I use rest APIs [0]. It’s worked great for the Twitter API so far. 10/10 would recommend. I started by scraping the API pages with script snippets that run on my own browser. Was wondering if something existed for JSON to TS and it looks like QuickType works pretty well. I kind of want to make something that will anonymize and compress the data for me from json and keep the particular types so I can keep feeding it through QuickType and keep around sample anonymized json data.
They are insanely powerful but can be a little too addictive