Currently, I found we could not use types imported from other files in the model file. For example, if I have two typescript files like this:
// types.ts
export type A = 'A' | 'a'
// models.ts
import { A } from './types.ts'
export interface Entity {
a: A
}
If trying to generate this model file, graphqlgen will throw an error about TypeError: Cannot read property 'kind' of undefined.
After some debugging, I found this is because of graphqlgen cannot build type getter for the imported type A.
I have seen something like filesToTypesMap and addFileToTypesMap are related to this, but looks like they are used for testing. So is it possible to have this kind of import working?
Additional context
I think this is useful when using graphqlgen with Prisma because Prisma will generate types according to the enums in the datamodel. And custom models may use this enum which needs to import types from the generated Prisma client types.
Description
Currently, I found we could not use types imported from other files in the model file. For example, if I have two typescript files like this:
If trying to generate this model file, graphqlgen will throw an error about
TypeError: Cannot read property 'kind' of undefined
. After some debugging, I found this is because of graphqlgen cannot build type getter for the imported typeA
.I have seen something like
filesToTypesMap
andaddFileToTypesMap
are related to this, but looks like they are used for testing. So is it possible to have this kind of import working?Additional context
I think this is useful when using graphqlgen with Prisma because Prisma will generate types according to the enums in the datamodel. And custom models may use this enum which needs to import types from the generated Prisma client types.