3 ms·
Typescript does have discriminated union types, you just have to use objects with a discriminating property which is a bit less ergonomic than the way those wor
by brundolf 5y ago
Typescript does have discriminated union types, you just have to use objects with a discriminating property which is a bit less ergonomic than the way those work in other languages. It's done this way to preserve TypeScript's goal of having little to no impact on runtime behavior