How to use generics defined in @types for a react native library

I have been trying to use the Agenda component from react-native-calendars library in Typescript. The issue I have been facing is that the type definition makes heavy use of generics mainly TItem to define types for various parameters. When I need to call functions that makes use of this generic the Typescript compiler in VSCode complains that the parameter is defined as any due to which I cannot use all the goodness of TS and I do not know how to incorporate these generics in my code.


function renderItem(item) {
  return (
      onPress={() => Alert.alert(}>

The compiler complains Parameter 'item' implicitly has an 'any' type. The item parameter in renderItem is supposed to be a TItem but how do I tell the compiler this?


TItem is the name of the generic type @types/react-native-calendars used. It has no meaning outside it being generic.

What you actually want is to tell the compiler that the argument of renderItem is of your type.

For example, if your item type is Foo:

function renderItem(item: Foo) {