Skip to content

Commit 9bba83f

Browse files
IvanGoncharovyaacovCR
authored andcommitted
Workaround for codesandbox having bug with TS enums (graphql#3686)
1 parent 5c7d4d1 commit 9bba83f

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

src/language/ast.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,12 @@ export interface OperationDefinitionNode {
343343
readonly selectionSet: SelectionSetNode;
344344
}
345345

346-
export enum OperationTypeNode {
346+
enum OperationTypeNode {
347347
QUERY = 'query',
348348
MUTATION = 'mutation',
349349
SUBSCRIPTION = 'subscription',
350350
}
351+
export { OperationTypeNode };
351352

352353
export interface VariableDefinitionNode {
353354
readonly kind: Kind.VARIABLE_DEFINITION;

src/language/directiveLocation.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* The set of allowed directive location values.
33
*/
4-
export enum DirectiveLocation {
4+
enum DirectiveLocation {
55
/** Request Definitions */
66
QUERY = 'QUERY',
77
MUTATION = 'MUTATION',
@@ -24,3 +24,5 @@ export enum DirectiveLocation {
2424
INPUT_OBJECT = 'INPUT_OBJECT',
2525
INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION',
2626
}
27+
28+
export { DirectiveLocation };

src/language/kinds.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* The set of allowed kind values for AST nodes.
33
*/
4-
export enum Kind {
4+
enum Kind {
55
/** Name */
66
NAME = 'Name',
77

@@ -72,3 +72,5 @@ export enum Kind {
7272
ENUM_TYPE_EXTENSION = 'EnumTypeExtension',
7373
INPUT_OBJECT_TYPE_EXTENSION = 'InputObjectTypeExtension',
7474
}
75+
76+
export { Kind };

src/language/tokenKind.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* An exported enum describing the different kinds of tokens that the
33
* lexer emits.
44
*/
5-
export enum TokenKind {
5+
enum TokenKind {
66
SOF = '<SOF>',
77
EOF = '<EOF>',
88
BANG = '!',
@@ -27,3 +27,5 @@ export enum TokenKind {
2727
BLOCK_STRING = 'BlockString',
2828
COMMENT = 'Comment',
2929
}
30+
31+
export { TokenKind };

src/type/introspection.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ export const __EnumValue: GraphQLObjectType = new GraphQLObjectType({
443443
} as GraphQLFieldConfigMap<GraphQLEnumValue, unknown>),
444444
});
445445

446-
export enum TypeKind {
446+
enum TypeKind {
447447
SCALAR = 'SCALAR',
448448
OBJECT = 'OBJECT',
449449
INTERFACE = 'INTERFACE',
@@ -453,6 +453,7 @@ export enum TypeKind {
453453
LIST = 'LIST',
454454
NON_NULL = 'NON_NULL',
455455
}
456+
export { TypeKind };
456457

457458
export const __TypeKind: GraphQLEnumType = new GraphQLEnumType({
458459
name: '__TypeKind',

src/utilities/findBreakingChanges.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import type { GraphQLSchema } from '../type/schema.js';
3434
import { astFromValue } from './astFromValue.js';
3535
import { sortValueNode } from './sortValueNode.js';
3636

37-
export enum BreakingChangeType {
37+
enum BreakingChangeType {
3838
TYPE_REMOVED = 'TYPE_REMOVED',
3939
TYPE_CHANGED_KIND = 'TYPE_CHANGED_KIND',
4040
TYPE_REMOVED_FROM_UNION = 'TYPE_REMOVED_FROM_UNION',
@@ -52,15 +52,17 @@ export enum BreakingChangeType {
5252
DIRECTIVE_REPEATABLE_REMOVED = 'DIRECTIVE_REPEATABLE_REMOVED',
5353
DIRECTIVE_LOCATION_REMOVED = 'DIRECTIVE_LOCATION_REMOVED',
5454
}
55+
export { BreakingChangeType };
5556

56-
export enum DangerousChangeType {
57+
enum DangerousChangeType {
5758
VALUE_ADDED_TO_ENUM = 'VALUE_ADDED_TO_ENUM',
5859
TYPE_ADDED_TO_UNION = 'TYPE_ADDED_TO_UNION',
5960
OPTIONAL_INPUT_FIELD_ADDED = 'OPTIONAL_INPUT_FIELD_ADDED',
6061
OPTIONAL_ARG_ADDED = 'OPTIONAL_ARG_ADDED',
6162
IMPLEMENTED_INTERFACE_ADDED = 'IMPLEMENTED_INTERFACE_ADDED',
6263
ARG_DEFAULT_VALUE_CHANGE = 'ARG_DEFAULT_VALUE_CHANGE',
6364
}
65+
export { DangerousChangeType };
6466

6567
export interface BreakingChange {
6668
type: BreakingChangeType;

0 commit comments

Comments
 (0)