Can enumType.members
allow readonly string[]
?
#455
Labels
community/good-first-issue
Good for newcomers
effort/easy
scope/backing-types
type/improve
Something existing is made better, does not affect the interface (example: better error message)
Projects
I have the following data setup (not declaring as an enum because this is shared between TypeScript server code and non-TypeScript client code):
TypeScript is rightly giving me an error here because I'm trying to put
TYPES
(areadonly string[]
) intomembers
which accepts astring[]
.https://github.com/graphql-nexus/schema/blob/bf0df64ebd9810f9a458aceb8c5ff52518607825/src/definitions/enumType.ts#L41-L45
To overcome the type issue the best solution I have found so far is to unwrap and then re-create the array:
members: [...TYPES]
Is there a better way to overcome the type issue? If not, could
enumType.members
be modified to allowreadonly
arrays, or doesmembers
need to be mutable?The text was updated successfully, but these errors were encountered: