Typescript server compilation error for graphql.scalar
#362
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It's hard to tell what causes this, to be honest, without a reproduction. Make sure you're outputting the introspection file in the optimised I'd recommend to make sure that Regarding enum values, there's several threads on this here and on our Discord.
In short, you can pass in custom scalar types for you enums via Personally, I'd make two points:
If you don't override the enum type (which is basically the general assumption we make, although we do support overriding this as said before), I'd stick to just using type annotations and just types as often as possible. I'm not 100% sure why you'd have a Zod schema for example if you've got GraphQL validating and deriving types for a given enum value. In short though, rather than doing It's hard to make any more specific recommendation without knowing the code of course |
Beta Was this translation helpful? Give feedback.
It's hard to tell what causes this, to be honest, without a reproduction. Make sure you're outputting the introspection file in the optimised
.d.ts
format. Especially if it's only happening sometimes then that's a little odd.I'd recommend to make sure that
graphql.scalar
is not itself also used in recursive types. I can see that you've got it in some kind of array there, but if you're passing that array to, say, Zod, that will just deepen the types for TypeScript and make it more likely that you hit the recursion limit, if there's no boundary between their types andgql.tada
's types.Regarding enum values, there's several threads on this here and on our Discord.
In short,…