I have migrated from react-navigation 4.x to 5.x. Since I am using typescript, I am trying to add the types. I should mention that the functionality works perfectly fine. However, I am getting this typescript error:
TS2345: Argument of type '["PaperPlaneDetails", { paperPlane: PaperPlaneInterface; returnRoute: string; }]' is not assignable to parameter of type '["PaperPlaneDetails"] | ["PaperPlaneDetails", undefined]'. Type '["PaperPlaneDetails", { paperPlane: PaperPlaneInterface; returnRoute: string; }]' is not assignable to type '["PaperPlaneDetails", undefined]'. Type '{ paperPlane: PaperPlaneInterface; returnRoute: string; }' is not assignable to type 'undefined'.
//OpenPaperPlaneModal.tsx located in ReceivePaperPlaneScreen.tsxtype AppStackParamList = { EditProfile: undefined; Introduction: undefined; PaperPlaneDetails: undefined; Logout: undefined; DebugScreen: undefined; PaperPlane: undefined; MyProfileScreen: undefined; FollowersScreen: undefined; FollowingScreen: undefined; UsersProfileScreen: undefined; SettingsScreen: undefined; CommentsScreen: undefined;};type PaperPlaneBottomTabNavigatorParamList = { TakePaperPlaneScreen: undefined; ReceivePaperPlaneScreen: undefined; NotificationScreen: undefined;};type OpenPaperPlaneModalNavigationProp = CompositeNavigationProp< BottomTabNavigationProp< PaperPlaneBottomTabNavigatorParamList,'ReceivePaperPlaneScreen'>, StackNavigationProp<AppStackParamList>>;export default function OpenPaperPlaneModal(props) { const navigation = useNavigation<OpenPaperPlaneModalNavigationProp>(); navigation.navigate('PaperPlaneDetails', { paperPlane: props.paperPlane, returnRoute: 'ReceivePaperPlaneScreen', });}
"typescript": '3.8.3'"@react-navigation/bottom-tabs": "^5.3.1","@react-navigation/native": "^5.2.1","@react-navigation/stack": "^5.2.16",