Open this example in the interactive library
Source code
type Area = "jobs" | "users";
type Action = "read" | "write";
console.log(
(() => {
type Tail<T> = T extends `jobs:${infer S}` ? S : never;
const suffix: Tail<"jobs:read"> = "read";
return suffix;
})(),
);
Sample output
read
