Skip to content

Typescript error #14

@mbrimmer83

Description

@mbrimmer83

React-native 59 has getItemLayout typing

getItemLayout?: ((data: SectionListData<any>[] | null, index: number) => {
    length: number;
    offset: number;
    index: number;
}) | undefined

Library type

export type SectionListDataProp = Array<{
  title: string
  data: any[]
}>

Type error

Type '(data: { title: string; data: any[]; }[], index: number) => { length: number; offset: number; index: number; }' is not assignable to type '(data: SectionListData<any>[] | null, index: number) => { length: number; offset: number; index: number; }'.
  Types of parameters 'data' and 'data' are incompatible.
    Type 'SectionListData<any>[] | null' is not assignable to type '{ title: string; data: any[]; }[]'.
      Type 'null' is not assignable to type '{ title: string; data: any[]; }[]'.

It looks like the types for data are no longer compatible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions