-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Closed
Labels
Description
I'm using React Router as a...
framework
Reproduction
- Go to https://stackblitz.com/edit/github-ovu8zgq7?file=app%2Froutes%2Fparams.%24test.tsx
- Wait for
npm install && npm run dev
- Observe that
'params.test' is possibly 'undefined'
on line 4
System Info
System:
OS: macOS 15.4.1
CPU: (10) arm64 Apple M1 Max
Memory: 86.69 MB / 32.00 GB
Shell: 3.7.1 - /opt/homebrew/bin/fish
Binaries:
Node: 20.18.1 - ~/.nvm/versions/node/v20.18.1/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v20.18.1/bin/npm
pnpm: 10.6.5 - ~/Library/pnpm/pnpm
bun: 1.2.13 - ~/.bun/bin/bun
Browsers:
Chrome: 136.0.7103.114
Safari: 18.4
npmPackages:
@react-router/dev: 7.6.1 => 7.6.1
@react-router/express: 7.6.1 => 7.6.1
@react-router/fs-routes: 7.6.1 => 7.6.1
@react-router/node: 7.6.1 => 7.6.1
@react-router/serve: 7.6.1 => 7.6.1
react-router: 7.6.1 => 7.6.1
vite: 6.3.5 => 6.3.5
Used Package Manager
npm
Expected Behavior
Route.LoaderArgs
should identify that $test
is a required param so that test
is a key in params
and that params.test
is a string
.
This worked fine in version 7.6.0
.
Actual Behavior
Route.LoaderArgs
does not identify $test
as a param, and test
is not an identified key in params
by TypeScript. params.test
is inferred as string | undefined
.
lhapaipai, yoni-noma, ngbrown, jgj, maimai77 and 2 more