4 ms·
Related https://github.com/microsoft/TypeScript/issues/54925 https://github.com/microsoft/TypeScript/issues/54925 My specific use case is pattern matching http
by mnahkies 1y ago
Related https://github.com/microsoft/TypeScript/issues/54925 https://github.com/microsoft/TypeScript/issues/54925
My specific use case is pattern matching http status codes to an expected response type, and today I'm able to work around it with this kind of construct https://github.com/mnahkies/openapi-code-generator/blob/main/packages%2Ftypescript-fetch-runtime%2Fsrc%2Ftypes.ts#L1-L26 https://github.com/mnahkies/openapi-code-generator/blob/main... - but it's esoteric, and feels likely to be less efficient to check than what you propose / a range type.
There's runtime checking as well in my implementation, but it's a priority for me to provide good errors at build time