Skip to content

Commit

Permalink
Version Packages (#99)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and github-actions[bot] committed Jul 18, 2022
1 parent bc8d6eb commit e7e227d
Show file tree
Hide file tree
Showing 15 changed files with 143 additions and 284 deletions.
21 changes: 0 additions & 21 deletions .changeset/orange-bugs-do.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/young-experts-deny.md

This file was deleted.

26 changes: 26 additions & 0 deletions packages/apollo/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# @ts-gql/apollo

## 0.12.0

### Minor Changes

- [#98](https://github.com/Thinkmill/ts-gql/pull/98) [`bc8d6eb`](https://github.com/Thinkmill/ts-gql/commit/bc8d6ebbf1021829de24d3c916dad5e0b3ab1edf) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - `ts-gql`'s `TypedDocumentNode` type is now compatible with [`@graphql-typed-document-node/core`](https://github.com/dotansimha/graphql-typed-document-node)'s `TypedDocumentNode`.

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`'s `TypedDocumentNode` extends `graphql`'s `DocumentNode`, this means that `getDocumentNode` from `@ts-gql/tag` is no longer necessary. This could be another cause for bugs if there are two APIs, one that accepts a `TypedDocumentNode` that you should use and another that accepts `DocumentNode` which you shouldn't use, you could accidentally use the API that accepts `DocumentNode` over the one that accepts `TypedDocumentNode` where previously you would get an error when passing a `TypedDocumentNode` to something accepting a `DocumentNode`.

#### 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's `TypedDocumentNode` 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`](https://github.com/Thinkmill/ts-gql/commit/bc8d6ebbf1021829de24d3c916dad5e0b3ab1edf)]:
- @ts-gql/tag@0.7.0

## 0.11.2

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/apollo/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@ts-gql/apollo",
"version": "0.11.2",
"version": "0.12.0",
"main": "dist/apollo.cjs.js",
"module": "dist/apollo.esm.js",
"license": "MIT",
"dependencies": {
"@ts-gql/tag": "^0.6.1"
"@ts-gql/tag": "^0.7.0"
},
"peerDependencies": {
"@apollo/client": "*",
Expand Down
6 changes: 6 additions & 0 deletions packages/compiler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @ts-gql/compiler

## 0.15.3

### Patch Changes

- [#98](https://github.com/Thinkmill/ts-gql/pull/98) [`bc8d6eb`](https://github.com/Thinkmill/ts-gql/commit/bc8d6ebbf1021829de24d3c916dad5e0b3ab1edf) Thanks [@mitchellhamilton](https://github.com/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 a `TypedDocumentNode` with no variables won't be alllowed to be passed to something expecting a `TypedDocumentNode` with the variables of `{ [key: string]: any }`

## 0.15.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-gql/compiler",
"version": "0.15.2",
"version": "0.15.3",
"main": "dist/compiler.cjs.js",
"module": "dist/compiler.esm.js",
"license": "MIT",
Expand Down
7 changes: 7 additions & 0 deletions packages/fetch/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @ts-gql/fetch

## 0.1.2

### Patch Changes

- Updated dependencies [[`bc8d6eb`](https://github.com/Thinkmill/ts-gql/commit/bc8d6ebbf1021829de24d3c916dad5e0b3ab1edf)]:
- @ts-gql/tag@0.7.0

## 0.1.1

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/fetch/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@ts-gql/fetch",
"version": "0.1.1",
"version": "0.1.2",
"main": "dist/fetch.cjs.js",
"module": "dist/fetch.esm.js",
"license": "MIT",
"dependencies": {
"@ts-gql/tag": "^0.6.1"
"@ts-gql/tag": "^0.7.0"
},
"peerDependencies": {
"graphql": "15 || 16"
Expand Down
7 changes: 7 additions & 0 deletions packages/next/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @ts-gql/next

## 16.0.3

### Patch Changes

- Updated dependencies [[`bc8d6eb`](https://github.com/Thinkmill/ts-gql/commit/bc8d6ebbf1021829de24d3c916dad5e0b3ab1edf)]:
- @ts-gql/compiler@0.15.3

## 16.0.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-gql/next",
"version": "16.0.2",
"version": "16.0.3",
"main": "dist/next.cjs.js",
"module": "dist/next.esm.js",
"license": "MIT",
Expand Down
21 changes: 21 additions & 0 deletions packages/tag/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# @ts-gql/tag

## 0.7.0

### Minor Changes

- [#98](https://github.com/Thinkmill/ts-gql/pull/98) [`bc8d6eb`](https://github.com/Thinkmill/ts-gql/commit/bc8d6ebbf1021829de24d3c916dad5e0b3ab1edf) Thanks [@mitchellhamilton](https://github.com/mitchellhamilton)! - `ts-gql`'s `TypedDocumentNode` type is now compatible with [`@graphql-typed-document-node/core`](https://github.com/dotansimha/graphql-typed-document-node)'s `TypedDocumentNode`.

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`'s `TypedDocumentNode` extends `graphql`'s `DocumentNode`, this means that `getDocumentNode` from `@ts-gql/tag` is no longer necessary. This could be another cause for bugs if there are two APIs, one that accepts a `TypedDocumentNode` that you should use and another that accepts `DocumentNode` which you shouldn't use, you could accidentally use the API that accepts `DocumentNode` over the one that accepts `TypedDocumentNode` where previously you would get an error when passing a `TypedDocumentNode` to something accepting a `DocumentNode`.

#### 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's `TypedDocumentNode` 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.

## 0.6.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/tag/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-gql/tag",
"version": "0.6.1",
"version": "0.7.0",
"main": "dist/tag.cjs.js",
"module": "dist/tag.esm.js",
"license": "MIT",
Expand Down
Loading

0 comments on commit e7e227d

Please sign in to comment.