Strings In Depth18 / 18
Up next

Template types over unions

type Method = "GET" | "POST";
type Path = "/users" | "/posts";
// every combination of the two unions
type Route = `${Method} ${Path}`;
const r: Route = "GET /users";
console.log(r);
What you're solving

cross-product of two literal unions