strict-routes
v1.0.0-rc.2
Published
zero-cost strictly typed routing in TypeScript
Downloads
5
Readme
Have you ever broken a link in your app with a stupid typo or by overlooking? No more.
Usage
import { strictRoutes } from 'strict-routes';
type Routes =
| '/'
| 'posts/{postId}'
| 'posts/{postId:number}/{commentId:string}'
const { navigate } = strictRoutes<Routes>()({
navigate:
})
navigate({ path: 'posts/{postId}', postId: 1 });
Installation
yarn add strict-routes
npm install strict-routes
TypeScript Version
Because strict-routes
is using template literal types it works with TypeScript 4.1 or newer.