I came across an error that I don't know how to solve.
I have a generic component in React Native that takes a T value extending unknow.
However, inside this type T I'm sure I'll have a type called "name".
The question is...is there any way to use the generic type and, in addition, put the name as the default of T?
My code is this...
type GridProps<T> = { data: T[];};export function Grid<T extends unknown>({ data }: GridProps<T>) { const { sizes } = useTheme(); return (<><GridHeader><Text content={`Encontrados ${data.length} items.`} color="gray-400" /></GridHeader><FlashList numColumns={2} data={data} estimatedItemSize={data.length} renderItem={({ item, index }) => (<GridItem style={ index % 2 === 0 ? { marginRight: sizes[2] } : { marginLeft: sizes[2] } }><Text content={item.name} /></GridItem> )} /></> );}