Skip to content

Unable to set enum as a type of a union #2265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 of 4 tasks
aitorllj93 opened this issue Jun 26, 2022 · 1 comment
Closed
2 of 4 tasks

Unable to set enum as a type of a union #2265

aitorllj93 opened this issue Jun 26, 2022 · 1 comment

Comments

@aitorllj93
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When setting an enum as a possible type of a union, it fails

Minimum reproduction code

https://gist.github.com/d3v0ps/92e4e866624f5e87004ef378f5e2b471

Steps to reproduce

  1. define an enum type
  2. register the enum
  3. define another type
  4. create a union type with the enum and the other type
  5. Unable to set the enum type as a possible union type

Expected behavior

The enum should be able to be registered as possible union type

Package version

10.0.8

Graphql version

graphql: 16.3.0
apollo-server-express: 3.6.7

NestJS version

8.4.3

Node.js version

14.16.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

Type 'readonly [typeof GenderType, typeof TextScalar]' is not assignable to type 'readonly Type[]'.
Type 'typeof GenderType | typeof TextScalar' is not assignable to type 'Type'.
Type 'typeof GenderType' is missing the following properties from type 'Type': apply, call, bind, prototype, and 5 more.ts(2322)
create-union-type.factory.d.ts(28, 12): The expected type comes from the return type of this signature.

@kamilmysliwiec
Copy link
Member

graphql/graphql-spec#215

@nestjs nestjs locked and limited conversation to collaborators Jun 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants