Skip to content

Commit 3d0202b

Browse files
committed
Clatify type inference with dynamic config
1 parent 7ea60a2 commit 3d0202b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

versioned_docs/version-8.x/upgrading-from-7.x.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ In React Navigation 8, we reworked the types to automatically determine the corr
8787
+ const navigation = useNavigation('Profile');
8888
```
8989

90-
If you're using dynamic configuration, unfortunately we cannot currently infer the types automatically. So it still requires manual annotation. However, now you need to use `as` instead of generics to make it clearer that this is unsafe:
90+
If you're using dynamic configuration, there is limited support for automatic inference of types. The available screens, params etc. can be inferred, so actions such as `navigation.setParams`, `navigation.navigate` etc. will be properly typed. However, navigator specific types such as `push`, `setOptions`, `addListener` etc. cannot be inferred. So it still requires manual annotation for those cases.
91+
92+
Additionally, now you need to use `as` instead of generics to make it clearer that this is unsafe:
9193

9294
```diff lang=ts
9395
- const navigation = useNavigation<StackNavigationProp<RootStackParamList, 'Profile'>>();

0 commit comments

Comments
 (0)