@graphql/schema.types not working
I have done all the necessary steps beforehand to use import type { User } from '@/graphql/schema.types', but i still get this Cannot find module '@/graphql/schema.types' or its corresponding type declarations. Can someone help me?

3 Replies
Hi @Viktor Hugi. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Hmm, I don't know enough to give you a confident answer yet. However, I can suggest checking the following steps based on the information available:
1. Ensure Correct File Generation: Make sure that the
graphql-codegen
script has been run successfully and that the schema.types.ts
file is generated in the expected directory. You can run the following command to generate the types:
This should generate the src/graphql/schema.types.ts
file. Source (https://refine.dev/docs/data/packages/hasura/#developer-experience).
2. Check Your tsconfig.json
: Ensure that your tsconfig.json
includes the directory where schema.types.ts
is located. The include
section should cover the path to your generated types.
3. Verify Import Paths: Double-check that the import path @/graphql/schema.types
is correct and matches the actual file structure. The @
symbol is often used as an alias, so ensure that it is correctly configured in your tsconfig.json
under the paths
option.
4. Install Necessary Packages: Ensure that all necessary packages are installed, including graphql
and any other dependencies required for type generation. You can refer to the Hasura documentation (https://refine.dev/docs/data/packages/hasura/#developer-experience) for the list of required packages.
If these steps do not resolve the issue, you might want to consult the GraphQL Code Generator Documentation (https://the-guild.dev/graphql/codegen/docs/getting-started) for more detailed troubleshooting steps.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1143952538882805912> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
absent-sapphireOP•5mo ago
thank you i resolved it