Error typescript-resolvers code generator version 0.16: Type 'NodeResolvers' is not generic. [2315]
Describe the bug
In version 0.16 the typescript-resolvers code generator creates compile errors.
It creates an IResolver type with
Node?: NodeResolvers<Context>;
To Reproduce To reproduce this error, I have created a demo project in https://github.com/chenglabs/code-generator-demo. When compiling with tsc, this results in the following error in src\server\generated\types.ts [ts] Type 'NodeResolvers' is not generic. [2315]
If I downgrade the code generator to version 0.15.2 everything works ok
Expected behavior
In version 0.16, it generated the following incorrect code for IResolvers:
Node?: NodeResolvers<Context>;
In version 0.15.2, this was.
Node?: NodeResolvers;
Environment:
- OS: Windows 10
- Codegen: v.0.16
- Node: v.10
Additional context To reproduce the problem: git clone https://github.com/chenglabs/code-generator-demo cd code-generator-demo yarn install yarn codegen yarn tsc
This seems to happen when you have GraphQL interfaces and unions in your schema.
I have the same issue, see these generated types:
UnitEventDetails?: UnitEventDetailsResolvers.Resolvers<Context>;
....
export namespace UnitEventDetailsResolvers {
export interface Resolvers {
__resolveType: ResolveType;
}
export type ResolveType<
R =
| "DamageReportEvent"
| "CanErrorEvent"
| "PrecheckEvent"
| "ServiceCalendarEvent"
| "ServiceHourEvent"
| "ServiceKmEvent",
Parent =
| DamageReportEvent
| CanErrorEvent
| PrecheckEvent
| ServiceCalendarEvent
| ServiceHourEvent
| ServiceKmEvent,
Context = IContext
> = TypeResolveFn<R, Parent, Context>;
Type 'Resolvers' is not generic.ts(2315)
I think it was fixed already, could you try 0.17.0-alpha.4317ee16?
I think it was fixed already, could you try
0.17.0-alpha.4317ee16?
This is working for me. Thanks!
fixed in https://github.com/dotansimha/graphql-code-generator/pull/1236 by @kamilkisiela ❤️ .
@seamusv We will release a new stable version tomorrow, but for now, you can use the alpha :) @janhartmann @lirbank @chenglabs can you please try to use the latest alpha version?
Yes, will do tomorrow morning at work!
Worked - looking forward for the stable release.
@dotansimha Thanks! It's working.