Typescript Template Literal Types

Jan 25, 2021 09:01 · 45 words · 1 minute read typescript

Using Typescript to create custom router params type checker

By using great new Typescript 4.1 feature Template Literal Types we can do some type sorcery :). Before we start make sure you are familiar with Typescript Conditional Types. Most common and useful example is extracting route params so let us give it a go: