sad-indigoS
Refine14mo ago
9 replies
sad-indigo

TData[] in getList rest data provider

how do i get the type in getList in the rest data provider

Type '<TData extends BaseRecord = BaseRecord>({ resource, pagination, filters, sorters, meta }: GetListParams) => Promise<{ data: BaseRecord[]; total: number; }>' is not assignable to type '<TData extends BaseRecord = BaseRecord>(params: GetListParams) => Promise<GetListResponse<TData>>'.
Type 'Promise<{ data: BaseRecord[]; total: number; }>' is not assignable to type 'Promise<GetListResponse<TData>>'.
Type '{ data: BaseRecord[]; total: number; }' is not assignable to type 'GetListResponse<TData>'.
Types of property 'data' are incompatible.
Type 'BaseRecord[]' is not assignable to type 'TData[]'.
Type 'BaseRecord' is not assignable to type 'TData'.
'BaseRecord' is assignable to the constraint of type 'TData', but 'TData' could be instantiated with a different subtype of constraint 'BaseRecord'.ts(2322)
types.d.ts(400, 5): The expected type comes from property 'getList' which is declared here on type 'Omit<Required<DataProvider>, "createMany" | "updateMany" | "deleteMany">'
(property) getList: <TData extends BaseRecord = BaseRecord>(params: GetListParams) => Promise<GetListResponse<TData>>
Was this page helpful?