Skip to content

Commit

Permalink
fix: remove NonNullable to fix recursive infer in PathConfigMap
Browse files Browse the repository at this point in the history
  • Loading branch information
johankasperi committed Apr 26, 2024
1 parent d0abdee commit 2a1e73e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion example/src/Screens/NotFound.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const NotFound = ({
<Text style={styles.title}>404 Not Found ({route.path})</Text>
<Button
variant="filled"
onPress={() => navigation.navigate('Home')}
onPress={() => navigation.navigate('Home', { screen: 'Examples' })}
style={styles.button}
>
Go to home
Expand Down
2 changes: 1 addition & 1 deletion example/src/screens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export type RootDrawerParamList = {
};

export type RootStackParamList = ExampleScreensParamList & {
Home: NavigatorScreenParams<RootDrawerParamList> | undefined;
Home: NavigatorScreenParams<RootDrawerParamList>;
NotFound: undefined;
};

Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1005,9 +1005,9 @@ export type PathConfig<ParamList extends {}> = {
};

export type PathConfigMap<ParamList extends {}> = {
[RouteName in keyof ParamList]?: NonNullable<
ParamList[RouteName]
> extends NavigatorScreenParams<infer T extends {}>
[RouteName in keyof ParamList]?: ParamList[RouteName] extends NavigatorScreenParams<
infer T
>
? string | PathConfig<T>
: string | Omit<PathConfig<{}>, 'screens' | 'initialRouteName'>;
};

0 comments on commit 2a1e73e

Please sign in to comment.