Skip to content

Commit

Permalink
fix: wrong type in react-navigation.d.ts (#6486)
Browse files Browse the repository at this point in the history
This code is actually throwing a type error because of a wrong type declaration with the action expecting to be only a `NavigationNavigateAction` while in reality any action can be dispatched not only the `navigate`.
```jsx
      StackActions.replace({
        routeName: 'MyRoute1',
        // this action is throwing a type error
        action: StackActions.push({
          routeName: 'MyRoute2',
        }),
      }),
```
  • Loading branch information
mtt87 authored and satya164 committed Jan 23, 2020
1 parent 2931bad commit ccb1f61
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions typescript/react-navigation.d.ts
Expand Up @@ -291,15 +291,15 @@ declare module 'react-navigation' {
newKey?: string;
routeName: string;
params?: NavigationParams;
action?: NavigationNavigateAction;
action?: NavigationAction;
}

export interface NavigationReplaceAction {
type: 'Navigation/REPLACE';
key: string;
routeName: string;
params?: NavigationParams;
action?: NavigationNavigateAction;
action?: NavigationAction;
}

export interface NavigationCompleteTransitionActionPayload {
Expand Down

0 comments on commit ccb1f61

Please sign in to comment.