3 ms·
TypeScript also lets you create subsets of infinite size. For example, a string template literal type can be a type with (theoretically) infinite string values
by nikeee 4y ago
TypeScript also lets you create subsets of infinite size. For example, a string template literal type can be a type with (theoretically) infinite string values matching a string template.
I've created a proposal for doing something similar with the number type that uses the relational operators (<, >, >=, <=) to narrow the types [1].
It may be not as useful as template literal types (which is why one could argue to not implement them), but it's interesting nonetheless.
[1]: https://github.com/microsoft/TypeScript/issues/43505 https://github.com/microsoft/TypeScript/issues/43505