react-native-draggable-flatlist icon indicating copy to clipboard operation
react-native-draggable-flatlist copied to clipboard

Incorrect types for FlatList

Open special-character opened this issue 5 years ago • 0 comments

Is your feature request related to a problem? Please describe. I am getting incorrect types for the underlying flatlist. The type error I get is:

Types of property 'data' are incompatible.
    Type 'readonly Data[] | null | undefined' is not assignable to type 'Data[]'.
      Type 'undefined' is not assignable to type 'Data[]'.

I took a look at the type for data in the react native FlatList here and it is different than the types for this module.

Core FlatList: https://github.com/facebook/react-native/blob/cd347a7e0ed29ae1049e041fcb34588e1aac76f9/Libraries/Lists/FlatList.js#L36

Draggable FlatList: https://github.com/computerjazz/react-native-draggable-flatlist/blob/master/src/index.tsx#L101

In the core FlatList data is optional but it is required here.

Describe the solution you'd like Can we just use the normal types for the properties of the core FlatList? I might be missing why we do it this way but I think it would be more consistent and less error prone for types.

special-character avatar Jun 02 '20 16:06 special-character