Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use generics instead of type casting in endpoints #211

Closed
tniezg opened this issue Jun 15, 2021 · 1 comment
Closed

Use generics instead of type casting in endpoints #211

tniezg opened this issue Jun 15, 2021 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@tniezg
Copy link
Contributor

tniezg commented Jun 15, 2021

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

-

@tniezg tniezg added the enhancement New feature or request label Jun 15, 2021
@tniezg tniezg self-assigned this Aug 30, 2021
@tniezg
Copy link
Contributor Author

tniezg commented Aug 30, 2021

#243

@tniezg tniezg closed this as completed Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant