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

can't find graphql modules for named exports in Typescript #582

Open
peterleiva opened this issue Mar 9, 2022 · 0 comments
Open

can't find graphql modules for named exports in Typescript #582

peterleiva opened this issue Mar 9, 2022 · 0 comments

Comments

@peterleiva
Copy link

Hi guys,

There's a way to define named exports for fragments and queries as says in the docs without giving typescript error. Currently i'm using:

// globals.d.ts

module "*.graphql" {
	import { DocumentNode } from "graphql";

	const schema: DocumentNode;
	export default schema;
}

but when i use import {Test} from 'file.graphql' typescript says it can't import graphql files. I don't want to use any because seems hacky and i'm using strict mode but there's a way or i have to define in the declarations (d.ts) files ?

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