From 0189ff4eb3f2b868b0cf902f33fe104d7c276b16 Mon Sep 17 00:00:00 2001 From: Mattia Asti Date: Thu, 23 Jan 2020 14:40:08 +0000 Subject: [PATCH] fix: wrong type in react-navigation.d.ts (#6486) 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', }), }), ``` --- packages/react-navigation/typescript/react-navigation.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-navigation/typescript/react-navigation.d.ts b/packages/react-navigation/typescript/react-navigation.d.ts index 92faf90f..fd97f8ea 100644 --- a/packages/react-navigation/typescript/react-navigation.d.ts +++ b/packages/react-navigation/typescript/react-navigation.d.ts @@ -291,7 +291,7 @@ declare module 'react-navigation' { newKey?: string; routeName: string; params?: NavigationParams; - action?: NavigationNavigateAction; + action?: NavigationAction; } export interface NavigationReplaceAction { @@ -299,7 +299,7 @@ declare module 'react-navigation' { key: string; routeName: string; params?: NavigationParams; - action?: NavigationNavigateAction; + action?: NavigationAction; } export interface NavigationCompleteTransitionActionPayload {