Is it possible to import a graphQL enum from a sch...
# orm-help
k
Is it possible to import a graphQL enum from a schema file to a typescript file or they're different kind of beasts?
m
This is exactly what
graphql-binding
and
prisma-binding
are made for. They will generate typescript code that match your GraphQL types. This enables you to import e.g. enums, input types etc.
👍 2
k
Maybe I don't understand something, but I thought bindings are for running queries and mutations as functions inside JS/TS. But I want to create a resolver response where a field is an enum (without re-defining the same enum in JS), e.g.: in
schema.graphql
Copy code
enum Direction {
  UP
  DOWN
}
type Guide {
  direction: Direction
}
type Query {
  guide: Guide
}
in
Query.ts
Copy code
// import enum Direction somehow...
return {
  direction: Direction.UP
}