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 readFragment from falling back to any return types #216

Merged
merged 5 commits into from
Apr 16, 2024

Conversation

kitten
Copy link
Member

@kitten kitten commented Apr 16, 2024

Resolves #215

Summary

This prevents readFragment(data) from falling back to any as a return type when no generic was passed. It also prevents readFragment(document, data) to evaluate to any when an invalid document is passed. This already errored previously on the document argument, but now also prevents any from being returned.

Set of changes

  • Prevent readFragment<DocumentType>(data) from evaluating to any when DocumentType is left out
  • Prevent readFragment(document, data) from evaluating to any, instead falling back to unknown on invalid inputs

Copy link

changeset-bot bot commented Apr 16, 2024

🦋 Changeset detected

Latest commit: 1f0b480

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kitten kitten merged commit 434150e into main Apr 16, 2024
2 checks passed
@kitten kitten deleted the fix/generic-on-readfragment branch April 16, 2024 10:47
@github-actions github-actions bot mentioned this pull request Apr 16, 2024
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.

readFragment leaks "any" when used without generic & explicit fragment.
2 participants