sandulat / routes-gen

Framework agnostic routes typings generator. Remix ☑️ SolidStart ☑️
MIT License
281 stars 12 forks source link

Optional Remix route creates type error when supplying dynamic segments object #31

Closed brandonpittman closed 1 year ago

brandonpittman commented 1 year ago

Describe the bug

If you have an optional Remix route, a type error occurs when supplying the dynamic segments object.

Your Example Website or App

https://stackblitz.com/edit/node-jcqyxc?file=app/routes.d.ts

Steps to Reproduce the Bug or Issue

  1. Create an optional route
  2. Call a route like route("/reports/:type?/:id/", {id: userId})
  3. The route type includes the ? from the optional route as part of the param's name, not its type definition.

Expected behavior

I should be able to use an optional route and be able to optionally pass the optional param.

Screenshots or Videos

CleanShot 2023-01-04 at 10 31 37@2x

Platform

Additional context

No response

sandulat commented 1 year ago

This is now released under routes-gen@0.6.0 (https://github.com/sandulat/routes-gen/pull/32). Thank you so much @brandonpittman!