fix(react-router): preserve required params in generatePath types#14856
fix(react-router): preserve required params in generatePath types#14856grzdev wants to merge 3 commits intoremix-run:mainfrom
Conversation
|
|
Hi @grzdev, Welcome, and thank you for contributing to React Router! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run. Thanks! - The Remix team |
|
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
Summary
generatePathcurrently types all path params as required, even when the path contains optional params like:id?.This change distinguishes required and optional path params in the type signature so optional params can be omitted while required params remain enforced.
Changes
OptionalPathParam<Path>to extract optional path paramsGeneratePathParams<Path>to model required and optional params separatelygeneratePathto useGeneratePathParams<Path>Verification
pnpm typechecknpx jest --testPathPattern generatePath