Just started learning GraphQL and I would like to share an enum that I exported in a express apollo server.
./src/shared/fruitsEnum.ts
export enum fruitsEnum{
APPLE,
ORANGE
}
Import the enum
./src/market/fruits.ts
import { fruitsEnum } from "./src/shared/fruitsEnum.ts"
export const typeDef = `
type Fruit{
id: ID
fruitName: fruitsEnum
}
type Query{
...
}
`
I tried doing this but I am getting Error: Unknown type fruitsEnum
. The reason that I put the enum in a separate location is because the same enum might be used at other schema. My goal is to have a shareable enum type but what went wrong here? It seems like the schema doesn’t accept variable that is being imported.