Lurker News

Comments (191) 32 threads

Show all comments

Showing thread 11 of 32

gitgud1 reply#
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#
I 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.