Like so: https://www.typescriptlang.org/play?jsx=4#code/C4TwDgpgBASg9...
TS' string literal types are powerful.
https://www.typescriptlang.org/docs/handbook/2/everyday-type...
edit: I did implement this a while back but found it gave me only so much additional value. Though I can imagine that large applications with dozens of developers might indeed benefit from type-safe routes to avoid dead links.