Way to add typings for custom scalars?
SkeLLLa opened this issue · comments
Alex commented
Hi. Is there any way or "recommended" way to add typings for custom scalars? For example, if I define new scalar UUID
with resolver that verifies that it's really UUID.
But in generated.ts those new scalars are typed as any
so I'm searching the best way to pass there proper typings.
Pablo Sáez commented
You can use the "codegenConfig.scalars" option https://github.com/mercurius-js/mercurius-typescript/tree/master/packages/mercurius-codegen#options
Pablo Sáez commented
codegenMercurius(app, {
targetPath: './src/graphql/generated.ts',
codegenConfig: {
scalars: {
UUID: "string"
}
}
}).catch(console.error)
Alex commented
Thanks, looks like I've missed that part of doc.