Skip to content

Remove TS overloads in favor of unions / simpler signatures #178

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

Closed
lakardion opened this issue Nov 15, 2023 · 0 comments · Fixed by #186
Closed

Remove TS overloads in favor of unions / simpler signatures #178

lakardion opened this issue Nov 15, 2023 · 0 comments · Fixed by #186
Labels
enhancement New feature or request

Comments

@lakardion
Copy link
Member

The main approach for the surface type layer of the library is based on function overloads. This approach helped with type inference of the different ways users could call the functions. However, overloads make the TS code really hard to read and maintain.

Although this might not be the ultimate solution (since TS library is a bit of a pain) it may greatly improve the ease for maintenance and change.
Considering microsoft/TypeScript#43371 , we might be able to shift towards a single function (and single input parameter) signature and get all the inferences right from a single parameter rather than having to define multiple overloads to tell apart the different use cases and types of the functions.
I believe this issue was also the reason of why we were requiring two parameters in createCustomServiceCall to be able to infer the callback type from the passed models.

 🚧

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

Successfully merging a pull request may close this issue.

1 participant