'Is there a way to add a placeholder for this type?
Obligatory: apologies if this has been asked before!
I'm working on a React Native project and would like to add a placeholder for the screen name:
type HomeNavProps = BottomTabNavigationProp<
RootStackParamList,
"Home"
>
Ideally, I'd like something more generic like:
type NavProps<T> = BottomTabNavigationProp<
RootStackParamList,
T
>
So I can then use it like:
const { navigate } = useNavigation<NavProps<"Home">>()
Granted I'm not sure how to do it, but when I try the above, I just get:
Type 'T' does not satisfy the constraint 'keyof RootStackParamList'.
For reference, RootStackParamList is:
type RootStackParamList = {
Home: undefined
Levels: undefined
Map: undefined
MyBadges: undefined
MyImpact: undefined
}
Is something like this possible?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
