3 ms·
> or a string that adheres to a certain pattern (like a postal code). This is somewhat supported with template literal types, https://www.typescriptlang.org/do
by hn_throwaway_99 3y ago
> or a string that adheres to a certain pattern (like a postal code).
This is somewhat supported with template literal types, https://www.typescriptlang.org/docs/handbook/2/template-literal-types.html https://www.typescriptlang.org/docs/handbook/2/template-lite.... However, there are good technical/performance reasons they don't support, for example, plain regexes - there is a HUGE discussion on this topic here, https://github.com/microsoft/TypeScript/issues/6579 https://github.com/microsoft/TypeScript/issues/6579.