#GraphQL (code first): Where to place `registerEnumType()`

4 messages · Page 1 of 1 (latest)

floral aspen
#

I want to use registerEnumType() to generate a GraphQL type from an enum (see the docs), however, I am not sure where to place it and how to use it?

I want to be able to re-use the GraphQL type, therefore I want to define it in a separate file and export it. Is it possible? 🤔

#

Oh, I have just noticed that under #1025200803239166012 , there is a GraphQL tag. Is there a way to move a post there? 🤔

#

Based on [this post](#1055106915010621512 message), I believe registerEnumType() should be placed right after the enum definition (in *.enum.ts file). Them, we can use it rightaway as a GQL type (using type => EnumName, not with the name defined in registerEnumType()).

Discord

Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.

onyx sphinx