fix: more improvements to types

This commit is contained in:
Satyajit Sahoo
2020-06-17 13:46:21 +02:00
parent 962456beb6
commit d2444887be
12 changed files with 36 additions and 30 deletions

View File

@@ -51,7 +51,7 @@ export type StackActionHelpers<ParamList extends ParamListBase> = {
* @param [params] Params object for the new route.
*/
replace<RouteName extends keyof ParamList>(
...args: ParamList[RouteName] extends undefined
...args: undefined extends ParamList[RouteName]
? [RouteName] | [RouteName, ParamList[RouteName]]
: [RouteName, ParamList[RouteName]]
): void;
@@ -63,7 +63,7 @@ export type StackActionHelpers<ParamList extends ParamListBase> = {
* @param [params] Params object for the route.
*/
push<RouteName extends keyof ParamList>(
...args: ParamList[RouteName] extends undefined | any
...args: undefined extends ParamList[RouteName]
? [RouteName] | [RouteName, ParamList[RouteName]]
: [RouteName, ParamList[RouteName]]
): void;

View File

@@ -42,7 +42,7 @@ export type TabActionHelpers<ParamList extends ParamListBase> = {
* @param [params] Params object for the route.
*/
jumpTo<RouteName extends Extract<keyof ParamList, string>>(
...args: ParamList[RouteName] extends undefined | any
...args: undefined extends ParamList[RouteName]
? [RouteName] | [RouteName, ParamList[RouteName]]
: [RouteName, ParamList[RouteName]]
): void;