ts-error-translator icon indicating copy to clipboard operation
ts-error-translator copied to clipboard

Translation request for 2717

Open MatchuPitchu opened this issue 1 year ago • 0 comments

Error Text

Subsequent property declarations must have the same type. Property 'path' must be of type 'string | undefined', but here has type 'AllPath | undefined'.

Supporting Information

Please provide other information which led to this error, and any specific questions you have about it:

I try to overwrite the path prop of the <Route /> component of react-router-dom to make it type safe. Normally, it's only a string. but this is not so nice as DX. I tried this approach, but this results in the error message above.

declare module 'react-router-dom' {
  interface PathRouteProps {
    path?: AllPath;
  }

  interface IndexRouteProps {
    path?: AllPath;
  }
}

MatchuPitchu avatar Dec 10 '23 16:12 MatchuPitchu