Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

how can I handle this type with only one parameter?

$
0
0

I have a model of these:

image: string;redirect_option: 'PROFILE' | 'PRODUCT';redirect: Product | User;

Now I render the list and want add a function:

const handleNavigateToRedirectedOption = ({ redirected_option, params }: { redirected_option: 'PROFILE' | 'PRODUCT'; redirect: Product | User;}) => {    redirected_option === 'PROFILE'&&  navigation.navigate('UserProfile', params);  };const renderItem = ({ item }) => (<Pressable onPress={}><Text>List</Text></Pressable>);

Now I get this error:

Argument of type 'IProduct | CurrentUser' is not assignable to parameter of type 'CurrentUser'.  Type 'IProduct' is missing the following properties from type 'CurrentUser': user_id, profile_image, 

I know the problem but IDK how can I solve it. this comes at navigation...params


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>