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

Document how to import graphql files (typed-query-document) #1047

Open
fregante opened this issue May 31, 2023 · 0 comments
Open

Document how to import graphql files (typed-query-document) #1047

fregante opened this issue May 31, 2023 · 0 comments

Comments

@fregante
Copy link
Contributor

Maybe the solution is hidden behind #1046, but so far I'm not seeing any types with the suggested tsconfig:

		"plugins": [
			{
				"name": "ts-graphql-plugin",
				"schema": "https://docs.github.com/public/schema.docs.graphql",
				"typegen": {
					"addons": [
						"ts-graphql-plugin/addons/typed-query-document"
					]
				}
			}
		]
import listPrsForFileQuery from './list-prs-for-file.gql';
// ^ Error: Cannot find module './list-prs-for-file.gql' or its corresponding type declarations.ts(2307)

Until now I had a simple string type export in my globals.d.ts:

declare module '*.gql' {
	export = string;
}

but I suppose I should let the typed query document take over instead, so I removed that declaration.

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

No branches or pull requests

1 participant