spree/spree-api-v2-js-sdk

Use generics instead of type casting in endpoints

tniezg opened this issue · 1 comments

Is your feature request related to a problem? Please describe.

All data returned by Spree must be typed in TypeScript. Doing so makes it easier to use in projects written in TypeScript that use the SDK. The current solution uses explicit typecasting to set the returned type. Using generics is safer.

Describe the solution you'd like.

Change return (await this.spreeResponse('patch', routes.checkoutNextPath(), token, params)) as IOrderResult into
return (await this.spreeResponse<IOrder>('patch', routes.checkoutNextPath(), token, params)).

Describe alternatives you've considered.

-

Additional context

-