Skip to content
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

feat!: accept DocumentNode input #183

Merged
merged 5 commits into from
Aug 3, 2020
Merged

Conversation

jasonkuhrt
Copy link
Owner

@jasonkuhrt jasonkuhrt commented Aug 3, 2020

closes #176

Example:

import gql from 'graphql-tag'

await request('https://foo.bar/graphql', gql`...`)

If you don't actually care about using DocumentNode but just
want the tooling support for gql template tag like IDE syntax
coloring and prettier autoformat then note you can use the
passthrough gql tag shipped with graphql-request to save a bit
of performance and not have to install another dep into your project.

import { gql } from 'graphql-request'

await request('https://foo.bar/graphql', gql`...`)

BREAKING CHANGE:

graphql-request now requires graphql version 14.x or 15.x as a peer dependency.

graphql-request uses a TypeScript type from the graphql package such that if you are using TypeScript to build your project and you are using graphql-request but don't have graphql installed TypeScript build will fail. Details here. If you are a JS user then you do not technically need to install graphql. However if you use an IDE that picks up TS types even for JS (like VSCode) then its still in your interest to install graphql so that you can benefit from enhanced type safety during development.

closes #176

Example:

```ts
import gql from 'graphql-tag'

await request('https://foo.bar/graphql', gql`...`)
```

If you don't actually care about using DocumentNode but just
want the tooling support for gql template tag like IDE syntax
coloring and prettier autoformat then note you can use the
passthrough gql tag shipped with graphql-request to save a bit
of performance and not have to install another dep into your project.

```ts
import { gql } from 'graphql-request'

await request('https://foo.bar/graphql', gql`...`)
```
package.json Show resolved Hide resolved
@jasonkuhrt jasonkuhrt changed the title feat: accept DocumentNode input feat!: accept DocumentNode input Aug 3, 2020
@jasonkuhrt jasonkuhrt merged commit e757927 into master Aug 3, 2020
@jasonkuhrt jasonkuhrt deleted the feat/176/document-node-support branch August 3, 2020 15:00
techeng322 pushed a commit to techeng322/GraphQL-Request that referenced this pull request Nov 12, 2023
closes #176

Example:

```ts
import gql from 'graphql-tag'

await request('https://foo.bar/graphql', gql`...`)
```

If you don't actually care about using DocumentNode but just
want the tooling support for gql template tag like IDE syntax
coloring and prettier autoformat then note you can use the
passthrough gql tag shipped with graphql-request to save a bit
of performance and not have to install another dep into your project.

```ts
import { gql } from 'graphql-request'

await request('https://foo.bar/graphql', gql`...`)
```

BREAKING CHANGE:

`graphql-request` now requires `graphql` version 14.x or 15.x as a peer dependency.

`graphql-request` uses a TypeScript type from the `graphql` package such that if you are using TypeScript to build your project and you are using `graphql-request` but don't have `graphql` installed TypeScript build will fail. Details [here](jasonkuhrt/graphql-request#183 (comment)). If you are a JS user then you do not technically need to install `graphql`. However if you use an IDE that picks up TS types even for JS (like VSCode) then its still in your interest to install `graphql` so that you can benefit from enhanced type safety during development.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support DocumentNode and string in query method?
1 participant