Skip to content
This repository has been archived by the owner on Feb 8, 2020. It is now read-only.

Commit

Permalink
fix: allow making params optional. fixes #80
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 committed Aug 28, 2019
1 parent 74c3377 commit a9d4813
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions packages/bottom-tabs/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export type BottomTabNavigationProp<
* @param [params] Params object for the route.
*/
jumpTo<RouteName extends Extract<keyof ParamList, string>>(
...args: ParamList[RouteName] extends void
? [RouteName]
...args: ParamList[RouteName] extends (undefined | any)
? [RouteName] | [RouteName, ParamList[RouteName]]
: [RouteName, ParamList[RouteName]]
): void;
};
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 @@ -274,8 +274,8 @@ type NavigationHelpersCommon<
* @param [params] Params object for the route.
*/
navigate<RouteName extends keyof ParamList>(
...args: ParamList[RouteName] extends undefined
? [RouteName] | [RouteName, undefined]
...args: ParamList[RouteName] extends (undefined | any)
? [RouteName] | [RouteName, ParamList[RouteName]]
: [RouteName, ParamList[RouteName]]
): void;

Expand All @@ -298,7 +298,7 @@ type NavigationHelpersCommon<
*/
replace<RouteName extends keyof ParamList>(
...args: ParamList[RouteName] extends undefined
? [RouteName] | [RouteName, undefined]
? [RouteName] | [RouteName, ParamList[RouteName]]
: [RouteName, ParamList[RouteName]]
): void;

Expand Down
4 changes: 2 additions & 2 deletions packages/material-bottom-tabs/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export type MaterialBottomTabNavigationProp<
* @param [params] Params object for the route.
*/
jumpTo<RouteName extends Extract<keyof ParamList, string>>(
...args: ParamList[RouteName] extends void
? [RouteName]
...args: ParamList[RouteName] extends (undefined | any)
? [RouteName] | [RouteName, ParamList[RouteName]]
: [RouteName, ParamList[RouteName]]
): void;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/material-top-tabs/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export type MaterialTopTabNavigationProp<
* @param [params] Params object for the route.
*/
jumpTo<RouteName extends Extract<keyof ParamList, string>>(
...args: ParamList[RouteName] extends void
? [RouteName]
...args: ParamList[RouteName] extends (undefined | any)
? [RouteName] | [RouteName, ParamList[RouteName]]
: [RouteName, ParamList[RouteName]]
): void;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/stack/src/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ export type StackNavigationProp<
* @param [params] Params object for the route.
*/
push<RouteName extends keyof ParamList>(
...args: ParamList[RouteName] extends void
? [RouteName]
...args: ParamList[RouteName] extends (undefined | any)
? [RouteName] | [RouteName, ParamList[RouteName]]
: [RouteName, ParamList[RouteName]]
): void;

Expand Down

0 comments on commit a9d4813

Please sign in to comment.