Releases: Thinkmill/ts-gql
@ts-gql/fetch@0.1.2
Patch Changes
- Updated dependencies [
bc8d6eb
]:- @ts-gql/tag@0.7.0
@ts-gql/compiler@0.15.3
Patch Changes
- #98
bc8d6eb
Thanks @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 aTypedDocumentNode
with no variables won't be alllowed to be passed to something expecting aTypedDocumentNode
with the variables of{ [key: string]: any }
@ts-gql/apollo@0.12.0
Minor Changes
-
#98
bc8d6eb
Thanks @mitchellhamilton! -ts-gql
'sTypedDocumentNode
type is now compatible with@graphql-typed-document-node/core
'sTypedDocumentNode
.The recommended usage of ts-gql with Apollo Client is now to use
@apollo/client
directly. 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/apollo
package 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/client
over@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
refetchQueries
will 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
'sTypedDocumentNode
extendsgraphql
'sDocumentNode
, this means thatgetDocumentNode
from@ts-gql/tag
is no longer necessary. This could be another cause for bugs if there are two APIs, one that accepts aTypedDocumentNode
that you should use and another that acceptsDocumentNode
which you shouldn't use, you could accidentally use the API that acceptsDocumentNode
over the one that acceptsTypedDocumentNode
where previously you would get an error when passing aTypedDocumentNode
to something accepting aDocumentNode
.Context behind this change
When ts-gql was originally written,
@graphql-typed-document-node/core
did not exist. Since then,@graphql-typed-document-node/core
has become used by Apollo Client and urql. Given that, maintaining types to adapt Apollo Client to ts-gql'sTypedDocumentNode
seems 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/tag@0.7.0
@ts-gql/eslint-plugin@0.8.3
Patch Changes
- #96
1cecb2c
Thanks @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/tag@0.6.1
Patch Changes
0e3e2f5
Thanks @mitchellhamilton! - Supportgraphql@16
@ts-gql/next@16.0.2
Patch Changes
-
5b800e7
Thanks @mitchellhamilton! - Republish after broken release -
Updated dependencies [
5b800e7
]:- @ts-gql/compiler@0.15.2
@ts-gql/next@16.0.1
Patch Changes
-
0e3e2f5
Thanks @mitchellhamilton! - Supportgraphql@16
-
Updated dependencies [
0e3e2f5
]:- @ts-gql/compiler@0.15.1
@ts-gql/fetch@0.1.1
Patch Changes
5b800e7
Thanks @mitchellhamilton! - Republish after broken release
@ts-gql/fetch@0.1.0
Minor Changes
c9356b8
Thanks @mitchellhamilton! - Initial release
Patch Changes
- Updated dependencies [
0e3e2f5
]:- @ts-gql/tag@0.6.1
@ts-gql/eslint-plugin@0.8.2
Patch Changes
5b800e7
Thanks @mitchellhamilton! - Republish after broken release