-
Notifications
You must be signed in to change notification settings - Fork 2.7k
also allow Complete and Partial datastate type overrides #12740
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
Conversation
🦋 Changeset detectedLatest commit: 2531d7c 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 |
commit: |
size-limit report 📦
|
src/core/types.ts
Outdated
@@ -247,17 +324,17 @@ export type ApolloQueryResult< | |||
|
|||
export type DataState<TData> = | |||
| { | |||
data: TData; | |||
data: TData.Complete<TData>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I'm not opposed to DataState.Complete<TData>
if we can make it both a type and a namespace. Otherwise I'd consider going with something like DataValue
as the namespace. I think TData
might be too confusing.
data: DataValue.Complete<TData>;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh the more I think of it, I kind of like DataValue
a bit more since it is meant to describe the "value" of the data
property. Thoughts on that name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sounds good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it!
Ugh, merged instead of squashing... manually undid that and squash-merged locally into 1c6e03c |
I first thought that we would be okay with only a
Streaming
override, but in the end we don't know what certain codegen setups might create, so we probably also need aComplete
andPartial
override.That would also be an escape hatch for use cases like #12738, allowing users to introduce
DeepReadonly
themselves.Since
Partial
is already a TS builtin andPartialData
felt weird, I opted for a namespace that exports all three - the nameTData
is very much up for debate here.