Statically Prevent 404s
Most web applications have route patterns like "/courses/:courseId". Then they link to the routes by manually building path strings. But there's no guarantee that links actually point to valid routes. When we change or delete routes, we might forget to update some of the links, turning them into 404s. This talk introduces static-path, an NPM package that statically ensures two things. First, every link must point to a valid route. Second, the link must provide values for all of the route params (like ":courseId"). We'll spend most of the talk building the types up from scratch to see how template literal types, conditional types, infer, and mapped types all combine to make this possible without code generation or other esoteric tricks.