3 ms·
TS is a bit more powerful than it appears here, because string literal values are recognized at the type level, so can be checked by the compiler when distingui
by sixbrx 7y ago
TS is a bit more powerful than it appears here, because string literal values are recognized at the type level, so can be checked by the compiler when distinguishing cases.
See for example: "Discriminated Unions" at https://www.typescriptlang.org/docs/handbook/advanced-types.html#discriminated-unions https://www.typescriptlang.org/docs/handbook/advanced-types.....