Generated TypeScript code contains references to an undefined name '_Service'?
api-haus opened this issue · comments
Yurii Chyrkov commented
package.json
"dependencies": {
"fastify": "^4.3.0",
"mercurius": "^10.1.0",
"mercurius-codegen": "^4.0.1",
}
Steps to reproduce:
- Clone https://github.com/api-haus/mercurius-codegen-bug
- Run
npm install && npm run codegen
to generate code
TypeScript errors in generated code:
src/generated.ts:148:33 - error TS2304: Cannot find name '_Service'.
148 _Service: ResolverTypeWrapper<_Service>;
~~~~~~~~
This issue is persistent for many months. I wonder why this is happening. Previously we had a working version and just removed broken code from file so the typings would work correctly.
Yurii Chyrkov commented
As a workaround I can create a global definition for _Service.
export {};
declare global {
type _Service = any;
}
Jedaan commented
as a workaround, you can define new scalar
scalar _Service