So I finally forced myself to write some TypeScript for real and I don't hate it. ?
Greenfield backend project so I was able to avoid `any` like the plague. That helped a bunch in making TS make sense.
Here's things I liked and things I didn't ?
Do like: automatic imports in @code. Shit's pure magic. Define a function, use it in a file, an import shows up. ?
No like: TypeScript didn't catch a single bug and not once did it have an error that didn't cause more trouble than it's worth.
I know request body might be null but I promise it won't ...
Do like: Using types to define all possible strings for an argument. Gives you helpful hints when using the function too ?
No like: Sometimes you just cannot avoid an `any`. Like when accepting JSON blobs from an API where you specifically want or need to allow blobbyness.
Because the input type is thus undefined, that `any` spreads through your code like a virus.
Do like: Discovering complex APIs through typings in the @types/X and DefinitelyTyped github repos. So much more pleasant than digging through library code or reading docs.
No like: The verbosity of named arguments. That shit sucks.
I couldn't figure out how to use TypeScript for JSON validation. Seems like it would be a great fit, but what if I don't know the full type? Is there such a thing as partial TypeScript types?
Something like this ....