From 8cc6bcbf2286b2e66f5561a6778d29ffa2712de3 Mon Sep 17 00:00:00 2001 From: Ashoat Tevosyan Date: Thu, 18 Apr 2019 21:12:31 -0400 Subject: [PATCH] [flow] Fix NavigationScreenProp.getParam type (#5830) In my last PR I flipped the order of these around to fix an error, but turns out that was just crippling the type. The correct solution here, to guarantee that the `$PropertyType` won't error if its type parameter don't have the property, is to use an unsealed object type. Some additional context in discussion on #5806. --- packages/react-navigation/flow/react-navigation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-navigation/flow/react-navigation.js b/packages/react-navigation/flow/react-navigation.js index b4e81522..8b0efe5c 100644 --- a/packages/react-navigation/flow/react-navigation.js +++ b/packages/react-navigation/flow/react-navigation.js @@ -588,8 +588,8 @@ declare module 'react-navigation' { fallback?: $ElementType< $PropertyType< {| + ...{| params: {} |}, ...$Exact, - ...{| params: {| [ParamName]: void |} |}, |}, 'params' >, @@ -598,8 +598,8 @@ declare module 'react-navigation' { ) => $ElementType< $PropertyType< {| + ...{| params: {} |}, ...$Exact, - ...{| params: {| [ParamName]: void |} |}, |}, 'params' >,