-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Cascade out type parameters for TypeScript 4.8 #9919
Cascade out type parameters for TypeScript 4.8 #9919
Conversation
@DanielRosenwasser: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
@@ -226,7 +227,7 @@ export class InMemoryCache extends ApolloCache<NormalizedCacheObject> { | |||
} | |||
} | |||
|
|||
public diff<TData, TVariables = any>( | |||
public diff<TData, TVariables extends OperationVariables = any>( |
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.
This could possibly be changed to
public diff<TData, TVariables extends OperationVariables = any>( | |
public diff<TData, TVariables extends OperationVariables = OperationVariables>( |
TGraphQLVariables = {}, | ||
TChildProps = DataProps<TData, TGraphQLVariables> | ||
TGraphQLVariables extends {} = {}, | ||
TChildProps extends { [x: string]: any; } = DataProps<TData, TGraphQLVariables> |
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.
A possible alternative:
TChildProps extends { [x: string]: any; } = DataProps<TData, TGraphQLVariables> | |
TChildProps extends Partial<DataProps<TData, TGraphQLVariables>> = DataProps<TData, TGraphQLVariables> |
or possibly, but suspiciously
TChildProps extends { [x: string]: any; } = DataProps<TData, TGraphQLVariables> | |
TChildProps extends {} = DataProps<TData, TGraphQLVariables> |
@DanielRosenwasser Thank you for making us aware of this change! |
The team discussed and we will target this for our upcoming |
these changes are squashed into #10041 to see if this change will help with the TS 4.8 upgrade. |
* Cascade out type parameters for TypeScript 4.8 * Add apparent fix for `graphql.tsx` by making TChildProps expect a partial type.
* Cascade out type parameters for TypeScript 4.8 * Add apparent fix for `graphql.tsx` by making TChildProps expect a partial type.
Hi there! 👋
TypeScript recently added some stricter checking around unconstrained generics being incompatible with emptyish object types. The changes are only in nightly versions of TypeScript right now, but we've been exploring how open-source projects have been impacted. These are the changes necessary for apollo-client to build cleanly in TypeScript 4.8.