3 ms·
Don’t you need some pretty solid source data for you to trust them? I only recently picked up typescript, coming from decades of .Net and later a Python, and t
by moksly 5y ago
Don’t you need some pretty solid source data for you to trust them?
I only recently picked up typescript, coming from decades of .Net and later a Python, and the way you can turn things like json results into typed data via interfaces while also having the vast open source libraries I’ve done to love from Python, I gotta say it’s just been so easy to work in an enterprise environment where the source data is often really terrible.
I can certainly follow the points of this article. It is sort of silly to type an uuid as a string, but when does it actually break?
- throwanem 5y agoWhen you don't get warned that you assigned or passed something that's a string but not a UUID, because the type checker can't tell them apart. Nominal types fix this. Typescript doesn't precisely implement them, but its "branded types" seem to be close enough for most purposes. For further discussion and a sandbox example, see https://www.typescriptlang.org/play#example/nominal-typing https://www.typescriptlang.org/play#example/nominal-typing