spotify / confidence-sdk-js

Other
9 stars 1 forks source link

refactor: remove the widen type #193

Closed andreas-karlsson closed 2 months ago

andreas-karlsson commented 2 months ago

Hi There, I just made a Pull Request!

This PR removes the "Widen" type which was there as a fix for return types being referred too narrowly. For instance the return value of getFlag should be of the same type as the default value arg. But if you called getFlag with a 3 as the default value the inferred return type would be 3 instead of number. The Widen type caused some unnecessary complexity though, and now the problem is fixed with overloads instead.

:heavy_check_mark: Checklist