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

How to make interface dynamic to remove redundancy in typescript?

$
0
0

I am using typescript with react-navigation library in my react-native application. I am annotating my screens as per guide provided in the official documentation.

The problem is there is so much repetition in the types I've created. Is there any way to make this type dynamic where I just have to provide screen name instead of defining all the types again and again.

Here is the code to annotate my screen where I want to make this "landing" string dynamic with respect to each screen. Hope I am clear.

type LandingProps = CompositeScreenProps<  NativeStackScreenProps<HomeStackParamList, "landing">,  DrawerScreenProps<AppDrawerParamList>>;

Viewing all articles
Browse latest Browse all 6581

Latest Images

Trending Articles



Latest Images