Describe the bug
I am getting a couple of errors on my generated file:
Every import { DocumentNode } from 'graphql'; yields a Cannot find module 'graphql'. error, even though I have graphql as a dev dependency.
Another error is at the export interface IntrospectionResultData { section, which is as follows ("possibleTypes": [] is empty because I cannot provide my graphql schema :( ):
export interface IntrospectionResultData {
__schema: {
types: {
kind: string;
name: string;
possibleTypes: {
name: string;
}[];
}[];
};
}
const result: IntrospectionResultData = {
"__schema": {
"types": [
{
"kind": "INTERFACE",
"name": "Node",
"possibleTypes": []
}
]
}
};
export default result;
This yields two errors, Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier. and Initializers are not allowed in ambient contexts..
The formatting and indentation seems off. It is exactly as I pasted it above.
My codegen.yml config file:
overwrite: true
schema: ""
documents:
- "./src/**/*.gql"
- "./src/**/*.ts"
generates:
src/@types/graphql.d.ts:
plugins:
- "typescript"
- "typescript-operations"
- "typescript-graphql-files-modules"
- "fragment-matcher"
Environment:
Fragment matcher has code inside so it cannot be .d.ts. Could change it to graphql.ts without .d and try again?
Worked, thanks!
Most helpful comment
Fragment matcher has code inside so it cannot be
.d.ts. Could change it tographql.tswithout.dand try again?