Explore Library
Code QuizIntermediate

TypeScript Typing for Params

Spot the typing mistake in the navigation param list setup.

Codetypescript
type RootStackParamList = {
  Home: undefined;
  Details: { itemId: number };
};

const Stack = createNativeStackNavigator();

type Props = NativeStackScreenProps<RootStackParamList, 'Details'>;

function Details({ route }: Props) {
  return <Text>{route.params.itemId}</Text>;
}

What is the bug in this code?