Skip to content
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

language: change OperationTypeNode to enum #3312

Merged
merged 2 commits into from Oct 13, 2021

Conversation

lekoaf
Copy link
Contributor

@lekoaf lekoaf commented Oct 12, 2021

Changes OperationTypeNode to enum instead of a union type.
This allows developers to use the type as OperationTypeNode.QUERY
instead of risking to msispell the string 'query'.

Example:

Instead of having to write

operation === 'query'

you can instead write

operation === OperationTypeNode.QUERY

(This is a continuation of #2887)

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 12, 2021

CLA Signed

The committers are authorized under a signed CLA.

@lekoaf
Copy link
Contributor Author

lekoaf commented Oct 12, 2021

Hmm, according to the linter, this may be a breaking change after all?

@saihaj
Copy link
Member

saihaj commented Oct 12, 2021

I think you just need to replace all places where we return string to return values from this enum

Changes OperationTypeNode to enum instead of a union type.
This allows developers to use the type as `OperationTypeNode.QUERY`
instead of risking to msispell the string 'query'.

Example:

Instead of having to write

`operation === 'query'`

you can instead write

`operation === OperationTypeNode.QUERY`
@IvanGoncharov IvanGoncharov added the PR: feature 🚀 requires increase of "minor" version number label Oct 13, 2021
@IvanGoncharov IvanGoncharov changed the title fix: change OperationTypeNode to enum language: change OperationTypeNode to enum Oct 13, 2021
@IvanGoncharov IvanGoncharov merged commit e289e64 into graphql:main Oct 13, 2021
@lekoaf lekoaf deleted the mt/operationTypeNode_enum branch October 13, 2021 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: feature 🚀 requires increase of "minor" version number
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants