diff --git a/.changeset/real-ties-cross.md b/.changeset/real-ties-cross.md new file mode 100644 index 00000000000..4489df349ea --- /dev/null +++ b/.changeset/real-ties-cross.md @@ -0,0 +1,5 @@ +--- +'@graphql-codegen/gql-tag-operations': minor +--- + +change the client-preset generated template diff --git a/dev-test/gql-tag-operations-masking-star-wars/gql/gql.ts b/dev-test/gql-tag-operations-masking-star-wars/gql/gql.ts index 2fbbf01707d..927f6d605eb 100644 --- a/dev-test/gql-tag-operations-masking-star-wars/gql/gql.ts +++ b/dev-test/gql-tag-operations-masking-star-wars/gql/gql.ts @@ -19,19 +19,6 @@ const documents = { types.HeroDetailsFragmentDoc, }; -/** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function gql( - source: '\n query HeroDetailsWithFragment($episode: Episode) {\n hero(episode: $episode) {\n ...HeroDetails\n }\n }\n' -): typeof documents['\n query HeroDetailsWithFragment($episode: Episode) {\n hero(episode: $episode) {\n ...HeroDetails\n }\n }\n']; -/** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function gql( - source: '\n fragment HeroDetails on Character {\n __typename\n name\n ... on Human {\n height\n }\n ... on Droid {\n primaryFunction\n }\n }\n' -): typeof documents['\n fragment HeroDetails on Character {\n __typename\n name\n ... on Human {\n height\n }\n ... on Droid {\n primaryFunction\n }\n }\n']; - /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -46,6 +33,19 @@ export function gql( **/ export function gql(source: string): unknown; +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n query HeroDetailsWithFragment($episode: Episode) {\n hero(episode: $episode) {\n ...HeroDetails\n }\n }\n' +): typeof documents['\n query HeroDetailsWithFragment($episode: Episode) {\n hero(episode: $episode) {\n ...HeroDetails\n }\n }\n']; +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql( + source: '\n fragment HeroDetails on Character {\n __typename\n name\n ... on Human {\n height\n }\n ... on Droid {\n primaryFunction\n }\n }\n' +): typeof documents['\n fragment HeroDetails on Character {\n __typename\n name\n ... on Human {\n height\n }\n ... on Droid {\n primaryFunction\n }\n }\n']; + export function gql(source: string) { return (documents as any)[source] ?? {}; } diff --git a/dev-test/gql-tag-operations-masking/gql/gql.ts b/dev-test/gql-tag-operations-masking/gql/gql.ts index 34eda97f265..4db702ed77a 100644 --- a/dev-test/gql-tag-operations-masking/gql/gql.ts +++ b/dev-test/gql-tag-operations-masking/gql/gql.ts @@ -22,6 +22,20 @@ const documents = { '\n query TweetAppQuery {\n ...TweetsFragment\n }\n': types.TweetAppQueryDocument, }; +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * + * + * @example + * ```ts + * const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`); + * ``` + * + * The query argument is unknown! + * Please regenerate the types. + **/ +export function gql(source: string): unknown; + /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -47,20 +61,6 @@ export function gql( source: '\n query TweetAppQuery {\n ...TweetsFragment\n }\n' ): typeof documents['\n query TweetAppQuery {\n ...TweetsFragment\n }\n']; -/** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - * - * - * @example - * ```ts - * const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`); - * ``` - * - * The query argument is unknown! - * Please regenerate the types. - **/ -export function gql(source: string): unknown; - export function gql(source: string) { return (documents as any)[source] ?? {}; } diff --git a/dev-test/gql-tag-operations/gql/gql.ts b/dev-test/gql-tag-operations/gql/gql.ts index 1cbe12139d6..6197b796ab4 100644 --- a/dev-test/gql-tag-operations/gql/gql.ts +++ b/dev-test/gql-tag-operations/gql/gql.ts @@ -18,6 +18,20 @@ const documents = { '\n query Bar {\n Tweets {\n ...Lel\n }\n }\n': types.BarDocument, }; +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * + * + * @example + * ```ts + * const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`); + * ``` + * + * The query argument is unknown! + * Please regenerate the types. + **/ +export function gql(source: string): unknown; + /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -37,20 +51,6 @@ export function gql( source: '\n query Bar {\n Tweets {\n ...Lel\n }\n }\n' ): typeof documents['\n query Bar {\n Tweets {\n ...Lel\n }\n }\n']; -/** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - * - * - * @example - * ```ts - * const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`); - * ``` - * - * The query argument is unknown! - * Please regenerate the types. - **/ -export function gql(source: string): unknown; - export function gql(source: string) { return (documents as any)[source] ?? {}; } diff --git a/dev-test/gql-tag-operations/graphql/gql.ts b/dev-test/gql-tag-operations/graphql/gql.ts index 06874e3e0c8..fbc8ee3d770 100644 --- a/dev-test/gql-tag-operations/graphql/gql.ts +++ b/dev-test/gql-tag-operations/graphql/gql.ts @@ -18,6 +18,20 @@ const documents = { '\n query Bar {\n Tweets {\n ...Lel\n }\n }\n': types.BarDocument, }; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + * + * + * @example + * ```ts + * const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`); + * ``` + * + * The query argument is unknown! + * Please regenerate the types. + **/ +export function graphql(source: string): unknown; + /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -37,20 +51,6 @@ export function graphql( source: '\n query Bar {\n Tweets {\n ...Lel\n }\n }\n' ): typeof documents['\n query Bar {\n Tweets {\n ...Lel\n }\n }\n']; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - * - * - * @example - * ```ts - * const query = gql(`query GetUser($id: ID!) { user(id: $id) { name } }`); - * ``` - * - * The query argument is unknown! - * Please regenerate the types. - **/ -export function graphql(source: string): unknown; - export function graphql(source: string) { return (documents as any)[source] ?? {}; } diff --git a/packages/plugins/typescript/gql-tag-operations/src/index.ts b/packages/plugins/typescript/gql-tag-operations/src/index.ts index 70da91052ce..b1f3c90b057 100644 --- a/packages/plugins/typescript/gql-tag-operations/src/index.ts +++ b/packages/plugins/typescript/gql-tag-operations/src/index.ts @@ -43,13 +43,7 @@ export const plugin: PluginFunction<{ ]; if (sourcesWithOperations.length > 0) { - code.push( - [ - ...getDocumentRegistryChunk(sourcesWithOperations), - `\n`, - ...getGqlOverloadChunk(sourcesWithOperations, gqlTagName, 'lookup', emitLegacyCommonJSImports), - ].join('') - ); + code.push([...getDocumentRegistryChunk(sourcesWithOperations)].join('')); } else { code.push('const documents = [];'); } @@ -67,6 +61,17 @@ export const plugin: PluginFunction<{ `**/\n`, `export function ${gqlTagName}(source: string): unknown;\n`, `\n`, + ].join('') + ); + + if (sourcesWithOperations.length > 0) { + code.push( + [...getGqlOverloadChunk(sourcesWithOperations, gqlTagName, 'lookup', emitLegacyCommonJSImports), `\n`].join('') + ); + } + + code.push( + [ `export function ${gqlTagName}(source: string) {\n`, ` return (documents as any)[source] ?? {};\n`, `}\n`, @@ -74,6 +79,7 @@ export const plugin: PluginFunction<{ ...documentTypePartial, ].join('') ); + return code.join(''); } diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index d2286376e15..c70ffff4a07 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -56,19 +56,6 @@ export * from "./fragment-masking"`); "\\n fragment C on Query {\\n c\\n }\\n": types.CFragmentDoc, }; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; - /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -83,6 +70,19 @@ export * from "./fragment-masking"`); **/ export function graphql(source: string): unknown; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; + export function graphql(source: string) { return (documents as any)[source] ?? {}; } @@ -144,19 +144,6 @@ export * from "./fragment-masking"`); "\\n fragment C on Query {\\n c\\n }\\n": types.CFragmentDoc, }; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query a {\\n a\\n }\\n"): (typeof documents)["\\n query a {\\n a\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query b {\\n b\\n }\\n"): (typeof documents)["\\n query b {\\n b\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; - /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -171,6 +158,19 @@ export * from "./fragment-masking"`); **/ export function graphql(source: string): unknown; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query a {\\n a\\n }\\n"): (typeof documents)["\\n query a {\\n a\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query b {\\n b\\n }\\n"): (typeof documents)["\\n query b {\\n b\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; + export function graphql(source: string) { return (documents as any)[source] ?? {}; } @@ -224,19 +224,6 @@ export * from "./fragment-masking"`); "\\n fragment C on Query {\\n c\\n }\\n": types.CFragmentDoc, }; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query a {\\n a\\n }\\n"): (typeof documents)["\\n query a {\\n a\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query b {\\n b\\n }\\n"): (typeof documents)["\\n query b {\\n b\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; - /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -251,6 +238,19 @@ export * from "./fragment-masking"`); **/ export function graphql(source: string): unknown; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query a {\\n a\\n }\\n"): (typeof documents)["\\n query a {\\n a\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query b {\\n b\\n }\\n"): (typeof documents)["\\n query b {\\n b\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; + export function graphql(source: string) { return (documents as any)[source] ?? {}; } @@ -305,19 +305,6 @@ export * from "./fragment-masking"`); "\\n fragment C on Query {\\n c\\n }\\n": types.CFragmentDoc, }; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; - /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -332,6 +319,19 @@ export * from "./fragment-masking"`); **/ export function graphql(source: string): unknown; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; + export function graphql(source: string) { return (documents as any)[source] ?? {}; } @@ -434,19 +434,6 @@ export * from "./fragment-masking"`); "\\n fragment C on Query {\\n c\\n }\\n": types.CFragmentDoc, }; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; - /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -461,6 +448,19 @@ export * from "./fragment-masking"`); **/ export function graphql(source: string): unknown; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; + export function graphql(source: string) { return (documents as any)[source] ?? {}; } @@ -554,11 +554,6 @@ export * from "./fragment-masking"`); "\\n query a {\\n a\\n }\\n": types.ADocument, }; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query a {\\n a\\n }\\n"): (typeof documents)["\\n query a {\\n a\\n }\\n"]; - /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -573,6 +568,11 @@ export * from "./fragment-masking"`); **/ export function graphql(source: string): unknown; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query a {\\n a\\n }\\n"): (typeof documents)["\\n query a {\\n a\\n }\\n"]; + export function graphql(source: string) { return (documents as any)[source] ?? {}; } @@ -668,19 +668,6 @@ export * from "./fragment-masking"`); "\\n fragment C on Query {\\n c\\n }\\n": types.CFragmentDoc, }; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; - /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -695,6 +682,19 @@ export * from "./fragment-masking"`); **/ export function graphql(source: string): unknown; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; + export function graphql(source: string) { return (documents as any)[source] ?? {}; } @@ -972,19 +972,6 @@ export * from "./fragment-masking.js"`); "\\n fragment C on Query {\\n c\\n }\\n": types.CFragmentDoc, }; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; - /** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; - /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -999,6 +986,19 @@ export * from "./fragment-masking.js"`); **/ export function graphql(source: string): unknown; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; + /** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function graphql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; + export function graphql(source: string) { return (documents as any)[source] ?? {}; } diff --git a/packages/presets/gql-tag-operations/tests/gql-tag-operations.spec.ts b/packages/presets/gql-tag-operations/tests/gql-tag-operations.spec.ts index 3b3d5d02dc8..6623783009a 100644 --- a/packages/presets/gql-tag-operations/tests/gql-tag-operations.spec.ts +++ b/packages/presets/gql-tag-operations/tests/gql-tag-operations.spec.ts @@ -55,19 +55,6 @@ describe('gql-tag-operations-preset', () => { "\\n fragment C on Query {\\n c\\n }\\n": types.CFragmentDoc, }; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; - /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -82,6 +69,19 @@ describe('gql-tag-operations-preset', () => { **/ export function gql(source: string): unknown; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; + export function gql(source: string) { return (documents as any)[source] ?? {}; } @@ -142,19 +142,6 @@ describe('gql-tag-operations-preset', () => { "\\n fragment C on Query {\\n c\\n }\\n": types.CFragmentDoc, }; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n query a {\\n a\\n }\\n"): (typeof documents)["\\n query a {\\n a\\n }\\n"]; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n query b {\\n b\\n }\\n"): (typeof documents)["\\n query b {\\n b\\n }\\n"]; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; - /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -169,6 +156,19 @@ describe('gql-tag-operations-preset', () => { **/ export function gql(source: string): unknown; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n query a {\\n a\\n }\\n"): (typeof documents)["\\n query a {\\n a\\n }\\n"]; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n query b {\\n b\\n }\\n"): (typeof documents)["\\n query b {\\n b\\n }\\n"]; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; + export function gql(source: string) { return (documents as any)[source] ?? {}; } @@ -222,19 +222,6 @@ describe('gql-tag-operations-preset', () => { "\\n fragment C on Query {\\n c\\n }\\n": types.CFragmentDoc, }; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n query a {\\n a\\n }\\n"): (typeof documents)["\\n query a {\\n a\\n }\\n"]; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n query b {\\n b\\n }\\n"): (typeof documents)["\\n query b {\\n b\\n }\\n"]; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; - /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -249,6 +236,19 @@ describe('gql-tag-operations-preset', () => { **/ export function gql(source: string): unknown; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n query a {\\n a\\n }\\n"): (typeof documents)["\\n query a {\\n a\\n }\\n"]; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n query b {\\n b\\n }\\n"): (typeof documents)["\\n query b {\\n b\\n }\\n"]; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; + export function gql(source: string) { return (documents as any)[source] ?? {}; } @@ -303,19 +303,6 @@ describe('gql-tag-operations-preset', () => { "\\n fragment C on Query {\\n c\\n }\\n": types.CFragmentDoc, }; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; - /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -330,6 +317,19 @@ describe('gql-tag-operations-preset', () => { **/ export function gql(source: string): unknown; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; + export function gql(source: string) { return (documents as any)[source] ?? {}; } @@ -428,11 +428,6 @@ describe('gql-tag-operations-preset', () => { "\\n query a {\\n a\\n }\\n": types.ADocument, }; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n query a {\\n a\\n }\\n"): (typeof documents)["\\n query a {\\n a\\n }\\n"]; - /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -447,6 +442,11 @@ describe('gql-tag-operations-preset', () => { **/ export function gql(source: string): unknown; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n query a {\\n a\\n }\\n"): (typeof documents)["\\n query a {\\n a\\n }\\n"]; + export function gql(source: string) { return (documents as any)[source] ?? {}; } @@ -900,19 +900,6 @@ describe('gql-tag-operations-preset', () => { "\\n fragment C on Query {\\n c\\n }\\n": types.CFragmentDoc, }; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; - /** - * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ - export function gql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; - /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * @@ -927,6 +914,19 @@ describe('gql-tag-operations-preset', () => { **/ export function gql(source: string): unknown; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n query A {\\n a\\n }\\n"): (typeof documents)["\\n query A {\\n a\\n }\\n"]; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n query B {\\n b\\n }\\n"): (typeof documents)["\\n query B {\\n b\\n }\\n"]; + /** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ + export function gql(source: "\\n fragment C on Query {\\n c\\n }\\n"): (typeof documents)["\\n fragment C on Query {\\n c\\n }\\n"]; + export function gql(source: string) { return (documents as any)[source] ?? {}; }