You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think we can solve this with an overload. Something like:
interfaceParamsNoPaginateextendsParams{// not a great name, I know..paginate: false}// service.d.tsexportdeclareclassAdapterService<T=any>implementsServiceMethods<T>{// ...find(params: ParamsNoPaginate): Promise<T[]>find(params?: Params): Promise<Paginate<T>>// ...}
I'm less comfortable with conditional types, but I suppose that would work as well and it would avoid having to extend Params.
The text was updated successfully, but these errors were encountered:
Expected behavior
It would be nice if the return type was automatically inferred from adapter services based on
params.paginate
Actual behavior
Instead, the type system does not know which return type to use, so we need to cast it.
Proposal
I think we can solve this with an overload. Something like:
I'm less comfortable with conditional types, but I suppose that would work as well and it would avoid having to extend
Params
.The text was updated successfully, but these errors were encountered: