Skip to content

kruschid/typesafe-routes

Repository files navigation

Typesafe Routes

Enhance your preferred routing library by incorporating powerful path generation including:

  • Path & template rendering
  • Nested, absolute, and relative paths
  • Parameter parsing and serialization
  • Type-safe, customizable, and extendable
  • Also useful with JavaScript

Quick Reference

The complete documentation can be found here.

  • Methods
    • render: renders a path with parameters
    • template: renders a route template
    • parseParams: parses dynamic segments in a path
    • parseQuery: parses parameters in a search query
  • Chainable operators:
    • bind: binds parameters to a route for later rendering
    • from: creates a new route based on a string-based path (i.e. location.path)
    • replace: replaces segments in a path

Installation

Version 11 is currently under development. Please don't use it in production yet. The official release will happen soon. The v10 documentation can be found here.

npm i typesafe-routes@next # or any npm alternatives

How to Contribute

  • leave a star ⭐
  • report a bug 🐞
  • open a pull request 🏗️
  • help others ❤️
  • buy me a coffee ☕

Buy Me A Coffee

Roadmap

  • v11 migration guide
  • check for duplicate param names in the route tree
  • context caching
  • customizable parsing of search params
  • demos & utils
    • react-router
    • refinejs
    • vue router
    • angular router