regexparam icon indicating copy to clipboard operation
regexparam copied to clipboard

RouteParams for route with both required and multiple optional parameters gives incorrect typing

Open tec27 opened this issue 1 year ago • 0 comments

With RouteParams<'/leagues/:routeId/:slugStr?/:subPage?'> the inferred types seem to parse the route incorrectly.

Expected:

{
  routeId: string;
  slugStr?: string | undefined;
  subPage?: string | undefined;
}

Actual:

{
  "routeId/slugStr"?: string | undefined;
  subPage?: string | undefined;
}

This is TS 5.6.2 if that makes a difference

tec27 avatar Sep 11 '24 03:09 tec27