Skip to content

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

@lekoaf lekoaf force-pushed the mt/operationTypeNode_enum branch from 85a1fee to c933764 Compare October 12, 2021 14:28
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`
@lekoaf lekoaf force-pushed the mt/operationTypeNode_enum branch from c933764 to c726830 Compare October 13, 2021 06:28
@lekoaf lekoaf requested a review from IvanGoncharov October 13, 2021 07:03
@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.

3 participants