Releases: Thinkmill/ts-gql
@ts-gql/[email protected]
Patch Changes
- Updated dependencies [
bc8d6eb]:- @ts-gql/[email protected]
@ts-gql/[email protected]
Patch Changes
- Updated dependencies [
bc8d6eb]:- @ts-gql/[email protected]
@ts-gql/[email protected]
Patch Changes
- #98
bc8d6ebThanks @mitchellhamilton! - When an operation has no variables, the variables type will now be{}instead of{ [key: string]: never }. The{ [key: string]: never }type attempts to describe an object with no properties but it means that aTypedDocumentNodewith no variables won't be alllowed to be passed to something expecting aTypedDocumentNodewith the variables of{ [key: string]: any }
@ts-gql/[email protected]
Minor Changes
-
#98
bc8d6ebThanks @mitchellhamilton! -ts-gql'sTypedDocumentNodetype is now compatible with@graphql-typed-document-node/core'sTypedDocumentNode.The recommended usage of ts-gql with Apollo Client is now to use
@apollo/clientdirectly. This also allows ts-gql to be used with urql and any other GraphQL client that supports@graphql-typed-document-node/core. The@ts-gql/apollopackage can still be used and may be updated in the future to avoid breakage if that makes sense but it is no longer the recommended pattern.When using
@apollo/clientover@ts-gql/apollo, it's important to note that some type safety will be lost:- Variables are always optional so omitting variables when they are required will no longer be caught by TypeScript
refetchQuerieswill accept any string so passing names to queries that don't exist will not cause a TypeScript error. You should likely pass in the document with the query itself to avoid mis-typing query names causing errors.
Because
@graphql-typed-document-node/core'sTypedDocumentNodeextendsgraphql'sDocumentNode, this means thatgetDocumentNodefrom@ts-gql/tagis no longer necessary. This could be another cause for bugs if there are two APIs, one that accepts aTypedDocumentNodethat you should use and another that acceptsDocumentNodewhich you shouldn't use, you could accidentally use the API that acceptsDocumentNodeover the one that acceptsTypedDocumentNodewhere previously you would get an error when passing aTypedDocumentNodeto something accepting aDocumentNode.Context behind this change
When ts-gql was originally written,
@graphql-typed-document-node/coredid not exist. Since then,@graphql-typed-document-node/corehas become used by Apollo Client and urql. Given that, maintaining types to adapt Apollo Client to ts-gql'sTypedDocumentNodeseems less sensible.While this does mean that some of ts-gql's safety is reduced, this seems like an appropriate trade-off so that ts-gql can reduce maintaince burden, avoid imposing opinions on top of GraphQL clients and support more GraphQL clients without having to write types for them specifically.
Patch Changes
- Updated dependencies [
bc8d6eb]:- @ts-gql/[email protected]
@ts-gql/[email protected]
Patch Changes
- #96
1cecb2cThanks @mitchellhamilton! - Fixed an internal error occurring when writing a selection set on a union type wrapped in a non-null or list type.
@ts-gql/[email protected]
Patch Changes
0e3e2f5Thanks @mitchellhamilton! - Supportgraphql@16
@ts-gql/[email protected]
Patch Changes
-
5b800e7Thanks @mitchellhamilton! - Republish after broken release -
Updated dependencies [
5b800e7]:- @ts-gql/[email protected]
@ts-gql/[email protected]
Patch Changes
-
0e3e2f5Thanks @mitchellhamilton! - Supportgraphql@16 -
Updated dependencies [
0e3e2f5]:- @ts-gql/[email protected]
@ts-gql/[email protected]
Patch Changes
5b800e7Thanks @mitchellhamilton! - Republish after broken release
@ts-gql/[email protected]
Minor Changes
c9356b8Thanks @mitchellhamilton! - Initial release
Patch Changes
- Updated dependencies [
0e3e2f5]:- @ts-gql/[email protected]