4 ms·
Arbitrary unions of literals as types have been done before dynamically (Lisps, Prologs, Erlang) and done elsewhere statically(Python). The more distinctive fe
by 1propionyl 2y ago
Arbitrary unions of literals as types have been done before dynamically (Lisps, Prologs, Erlang) and done elsewhere statically(Python).
The more distinctive features in TypeScript would be what you can to with keyof/typeof, indexed access types, conditional types and especially mapped types.
- simplify 2y agoTypeScript's unions are still impressive as you can union anything, not just literal types (TIL python has unions for literals, thanks). Out of curiosity, what do you mean by dynamically? Isn't that just a case statement, or am I misunderstanding?
- 1propionyl 2y ago> TypeScript's unions are still impressive as you can union anything, not just literal types (TIL python has unions for literals, thanks). You can do this in Python too..?