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
Add stricter typing to from
in useFragment
#11487
base: main
Are you sure you want to change the base?
Conversation
|
Name | Link |
---|---|
🔨 Latest commit | be233c9 |
🦋 Changeset detectedLatest commit: 3952a5f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
useFragment
from
typingfrom
in useFragment
Hi there, thanks for the PR! Could you please give an example where this is useful? From reading the code changes, I have a rough idea on the intent, but tbh., I have the feeling that this might break some use cases with unions and interfaces, so we'll have to be very careful here. |
Optimises the type to infer the __typename of the TypedDocumentNode that is passed in. I don't think you would ever pass in a different __typename but happy to be corrected.
I wasn't sure if the
TData extends { __typename?: string | undefined }
logic belonged within StoreObject itself so I added another type to contain that logic.Or possibly the type for
from
could be a Partial of TData?Checklist: