Skip to content

Commit cd22810

Browse files
Ashoatbrentvatne
authored andcommitted
[flow] Fix NavigationScreenProp.getParam type (react-navigation#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 react-navigation#5806.
1 parent 3f8a4d4 commit cd22810

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

flow/react-navigation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,8 @@ declare module 'react-navigation' {
588588
fallback?: $ElementType<
589589
$PropertyType<
590590
{|
591+
...{| params: {} |},
591592
...$Exact<S>,
592-
...{| params: {| [ParamName]: void |} |},
593593
|},
594594
'params'
595595
>,
@@ -598,8 +598,8 @@ declare module 'react-navigation' {
598598
) => $ElementType<
599599
$PropertyType<
600600
{|
601+
...{| params: {} |},
601602
...$Exact<S>,
602-
...{| params: {| [ParamName]: void |} |},
603603
|},
604604
'params'
605605
>,

0 commit comments

Comments
 (0)