3 ms·
Wow, I hope the typescript compiler is ready for this kind of dynamic complexity... type Protocol = 'http' | 'https'; type DomainExtension = 'com' | 'o
by gitgud 6y ago
Wow, I hope the typescript compiler is ready for this kind of dynamic complexity...
type Protocol = 'http' | 'https';
type DomainExtension = 'com' | 'org' | 'net';
type DomainName = 'example' | 'google';
type Domain = `${DomainName}.${DomainExtension}`;
type Path = string;
type ApiEndpoint = `${Protocol}://${Domain}/${Path}`;
This would seemingly get out of hand very quickly...
- ruffrey 6y agoI work on a codebase with a lot of this type of code. So far the compiler is up for it. The only time it gets slow is using the Zod language for runtime validation.