graphql-let
graphql-let copied to clipboard
Codegen may fail if `noEmitOnError: true` is set on tsconfig.json
I can only speculate as to exactly why this is, but here is my best guess based on experimenting:
- Some initial compilation occurs to generate the .d.ts in the cache location
- This initial compilation reports ts errors, maybe because of hard-coded paths, or circular dependencies between the generated types and the user's code. Either way, errors are expected before the generated types are correct location.
- With
noEmitOnError: true
set, the .d.ts is never emitted and cannot be copied to@types/graphql-let/__generated__
. The final type-check by graphql-let subsequently fails.
My workaround for this is the TSConfigFile
config option (thank you for that!):
.graphql-let.yml:
TSConfigFile: ./tsconfig.graphql-let.json
tsconfig.graphql-let.json:
{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmitOnError": false
}
}
It would be neater if the noEmitOnError
option was set to false
before performing ts compilation (essentially ignoring this option in the user's tsconfig). Or, this edge case could be added to the readme, describing the workaround above. This took me a couple of hours to figure out and might save someone else some pain :)
This would probably also apply to the noEmit
option; maybe some others too.