Skip to content

Commit

Permalink
fix(react-router): check if strictNullChecks are enabled (#2457)
Browse files Browse the repository at this point in the history
this flag is required for router typings to work properly. if it is not enabled, strange errors can occur.
  • Loading branch information
schiller-manuel authored Oct 3, 2024
1 parent 8804d8b commit 32ba7ed
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/react-router/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -581,12 +581,14 @@ export function createRouter<
TDehydrated extends Record<string, any> = Record<string, any>,
TSerializedError extends Record<string, any> = Record<string, any>,
>(
options: RouterConstructorOptions<
TRouteTree,
TTrailingSlashOption,
TDehydrated,
TSerializedError
>,
options: undefined extends number
? 'strictNullChecks must be enabled in tsconfig.json'
: RouterConstructorOptions<
TRouteTree,
TTrailingSlashOption,
TDehydrated,
TSerializedError
>,
) {
return new Router<
TRouteTree,
Expand Down

0 comments on commit 32ba7ed

Please sign in to comment.