Skip to content

Commit 50e28af

Browse files
committed
fix: import graphql-request RequestOptions as type
1 parent 4314b67 commit 50e28af

4 files changed

Lines changed: 13 additions & 13 deletions

File tree

packages/plugins/typescript/graphql-request/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphql-codegen/typescript-graphql-request",
3-
"version": "7.0.0",
3+
"version": "7.0.1",
44
"type": "module",
55
"description": "GraphQL Code Generator plugin for generating a ready-to-use SDK based on graphql-request and GraphQL operations",
66
"repository": {

packages/plugins/typescript/graphql-request/src/visitor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class GraphQLRequestVisitor extends ClientSideBaseVisitor<
4848
const typeImport = this.config.useTypeImports ? 'import type' : 'import';
4949

5050
this._additionalImports.push(
51-
`${typeImport} { GraphQLClient, RequestOptions } from 'graphql-request';`,
51+
`${typeImport} { GraphQLClient, type RequestOptions } from 'graphql-request';`,
5252
);
5353

5454
if (this.config.rawRequest) {

packages/plugins/typescript/graphql-request/tests/__snapshots__/graphql-request.spec.ts.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?:
88
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
99
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
1010
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
11-
import { GraphQLClient, RequestOptions } from 'graphql-request';
11+
import { GraphQLClient, type RequestOptions } from 'graphql-request';
1212
type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];
1313
/** All built-in and custom scalars, mapped to their actual values */
1414
export type Scalars = {
@@ -295,7 +295,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?:
295295
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
296296
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
297297
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
298-
import { GraphQLClient, RequestOptions } from 'graphql-request';
298+
import { GraphQLClient, type RequestOptions } from 'graphql-request';
299299
type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];
300300
import gql from 'graphql-tag';
301301
/** All built-in and custom scalars, mapped to their actual values */
@@ -576,7 +576,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?:
576576
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
577577
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
578578
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
579-
import { GraphQLClient, RequestOptions } from 'graphql-request';
579+
import { GraphQLClient, type RequestOptions } from 'graphql-request';
580580
type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];
581581
/** All built-in and custom scalars, mapped to their actual values */
582582
export type Scalars = {
@@ -856,7 +856,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?:
856856
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
857857
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
858858
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
859-
import type { GraphQLClient, RequestOptions } from 'graphql-request';
859+
import type { GraphQLClient, type RequestOptions } from 'graphql-request';
860860
import { GraphQLError, print } from 'graphql'
861861
type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];
862862
import gql from 'graphql-tag';
@@ -1142,7 +1142,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?:
11421142
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
11431143
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
11441144
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
1145-
import { GraphQLClient, RequestOptions } from 'graphql-request';
1145+
import { GraphQLClient, type RequestOptions } from 'graphql-request';
11461146
import { GraphQLError } from 'graphql'
11471147
type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];
11481148
/** All built-in and custom scalars, mapped to their actual values */
@@ -1424,7 +1424,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?:
14241424
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
14251425
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
14261426
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
1427-
import { GraphQLClient, RequestOptions } from 'graphql-request';
1427+
import { GraphQLClient, type RequestOptions } from 'graphql-request';
14281428
type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];
14291429
import gql from 'graphql-tag';
14301430
/** All built-in and custom scalars, mapped to their actual values */
@@ -1706,7 +1706,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?:
17061706
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
17071707
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
17081708
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
1709-
import { GraphQLClient, RequestOptions } from 'graphql-request';
1709+
import { GraphQLClient, type RequestOptions } from 'graphql-request';
17101710
import { GraphQLError, print } from 'graphql'
17111711
type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];
17121712
import gql from 'graphql-tag';
@@ -1992,7 +1992,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?:
19921992
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
19931993
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
19941994
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
1995-
import { GraphQLClient, RequestOptions } from 'graphql-request';
1995+
import { GraphQLClient, type RequestOptions } from 'graphql-request';
19961996
import { GraphQLError, print } from 'graphql'
19971997
type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];
19981998
import gql from 'graphql-tag';
@@ -2278,7 +2278,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?:
22782278
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
22792279
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
22802280
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
2281-
import type { GraphQLClient, RequestOptions } from 'graphql-request';
2281+
import type { GraphQLClient, type RequestOptions } from 'graphql-request';
22822282
type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];
22832283
import gql from 'graphql-tag';
22842284
/** All built-in and custom scalars, mapped to their actual values */
@@ -2560,7 +2560,7 @@ export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?:
25602560
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
25612561
export type MakeEmpty<T extends { [key: string]: unknown }, K extends keyof T> = { [_ in K]?: never };
25622562
export type Incremental<T> = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never };
2563-
import { GraphQLClient, RequestOptions } from 'graphql-request';
2563+
import { GraphQLClient, type RequestOptions } from 'graphql-request';
25642564
type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];
25652565
import gql from 'graphql-tag';
25662566
/** All built-in and custom scalars, mapped to their actual values */

packages/plugins/typescript/graphql-request/tests/__snapshots__/graphql-request.v16+.spec.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper =
3333
}
3434
export type Sdk = ReturnType<typeof getSdk>;",
3535
"prepend": [
36-
"import { GraphQLClient, RequestOptions } from 'graphql-request';",
36+
"import { GraphQLClient, type RequestOptions } from 'graphql-request';",
3737
"type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];",
3838
"import gql from 'graphql-tag';",
3939
],

0 commit comments

Comments
 (0)