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

fix: prevent resolver from widening output type #74

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

andrew0
Copy link
Contributor

@andrew0 andrew0 commented Dec 6, 2023

If the resolver for a field returns a union where one of the constituents satisfies the expected type, then TypeScript widens the Out type to allow the union, but the resolver's type should be limited to what the type option allows. Adding this NoInfer utility prevents TypeScript from widening the type in this case.

If the resolver for a field returns a union where one of the constituents
satisfies the expected type, then TypeScript widens the `Out` type to allow the
union, but the resolver's type should be limited to what the `type` option
allows. Adding this `NoInfer` utility prevents TypeScript from widening the
type in this case.
@sikanhe
Copy link
Owner

sikanhe commented Dec 8, 2023

nice 💯

@sikanhe sikanhe merged commit 4e327db into sikanhe:master Dec 8, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants