3 ms·
Have you ever used a language where types can influence runtime behavior? It's an extremely powerful tool to do things like choosing a specialized sort algorith
by jupp0r 4y ago
Have you ever used a language where types can influence runtime behavior? It's an extremely powerful tool to do things like choosing a specialized sort algorithm based on the type of contents of array you are sorting. This has zero overhead iff types are known at compile time and can yet hit different code paths at runtime. To just dismiss this as not needed is extremely short sighted in my opinion.
- Waterluvian 4y agoHaving types at runtime is a big deal and I lament that typescript can’t do it (for understandable reasons.)
- eyelidlessness 4y agoI have. And I think the limitation is good for a language that doesn’t have that. I don’t want TypeScript to lie to me about its capabilities, I want it to help me make good decisions with the runtime code I actually have.
- egeozcan 4y agoYou can always use zod or io-TS.