From 9c17854ba132b63608a29cdfc5d0536d3af5169a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Trob=C3=A4ck?= Date: Wed, 20 Jan 2021 10:43:01 +0100 Subject: [PATCH] fix: change OperationTypeNode to 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` This should not be a breaking change, since the string version should still work. --- src/language/ast.d.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/language/ast.d.ts b/src/language/ast.d.ts index 61cb9f4eb5..aba0bbcf22 100644 --- a/src/language/ast.d.ts +++ b/src/language/ast.d.ts @@ -234,7 +234,11 @@ export interface OperationDefinitionNode { readonly selectionSet: SelectionSetNode; } -export type OperationTypeNode = 'query' | 'mutation' | 'subscription'; +export enum OperationTypeNode { + QUERY = 'query', + MUTATION = 'mutation', + SUBSCRIPTION = 'subscription', +} export interface VariableDefinitionNode { readonly kind: 'VariableDefinition';