sacred-emeraldS
Refine16mo ago
9 replies
sacred-emerald

Custom dataProvider create and update Tvariables constrained specific type error

I am getting this error in my custom dataProvider with the create and update methods.
How can get around it
Errors
Type '<TData extends BaseRecord = BaseRecord, TVariables extends CreateLeadPayload = CreateLeadPayload>(params: CreateParams<TVariables>) => Promise<CreateResponse<TData>>' is not assignable to type '<TData extends BaseRecord = BaseRecord, TVariables = {}>(params: CreateParams<TVariables>) => Promise<CreateResponse<TData>>'.
Types of parameters 'params' and 'params' are incompatible.
Type 'CreateParams<TVariables>' is not assignable to type 'CreateParams<CreateLeadPayload>'.
Type 'TVariables' is not assignable to type 'CreateLeadPayload'.ts(2322)
types.d.ts(403, 53): This type parameter might need an extends CreateLeadPayload constraint.
types.d.ts(403, 5): The expected type comes from property 'create' which is declared here on type 'CustomDataProvider'
My code.
Was this page helpful?