Skip to content

Commit af8221a

Browse files
Workaround for codesandbox having bug with TS enums (#3686)
1 parent 59a73d6 commit af8221a

File tree

6 files changed

+14
-7
lines changed

6 files changed

+14
-7
lines changed

src/language/ast.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,12 @@ export interface OperationDefinitionNode {
323323
readonly selectionSet: SelectionSetNode;
324324
}
325325

326-
export enum OperationTypeNode {
326+
enum OperationTypeNode {
327327
QUERY = 'query',
328328
MUTATION = 'mutation',
329329
SUBSCRIPTION = 'subscription',
330330
}
331+
export { OperationTypeNode };
331332

332333
export interface VariableDefinitionNode {
333334
readonly kind: Kind.VARIABLE_DEFINITION;

src/language/directiveLocation.ts

+2-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,6 +24,7 @@ export enum DirectiveLocation {
2424
INPUT_OBJECT = 'INPUT_OBJECT',
2525
INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION',
2626
}
27+
export { DirectiveLocation };
2728

2829
/**
2930
* The enum type representing the directive location values.

src/language/kinds.ts

+2-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

@@ -67,6 +67,7 @@ export enum Kind {
6767
ENUM_TYPE_EXTENSION = 'EnumTypeExtension',
6868
INPUT_OBJECT_TYPE_EXTENSION = 'InputObjectTypeExtension',
6969
}
70+
export { Kind };
7071

7172
/**
7273
* The enum type representing the possible kind values of AST nodes.

src/language/tokenKind.ts

+2-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 = '!',
@@ -26,6 +26,7 @@ export enum TokenKind {
2626
BLOCK_STRING = 'BlockString',
2727
COMMENT = 'Comment',
2828
}
29+
export { TokenKind };
2930

3031
/**
3132
* The enum type representing the token kinds values.

src/type/introspection.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ export const __EnumValue: GraphQLObjectType = new GraphQLObjectType({
435435
} as GraphQLFieldConfigMap<GraphQLEnumValue, unknown>),
436436
});
437437

438-
export enum TypeKind {
438+
enum TypeKind {
439439
SCALAR = 'SCALAR',
440440
OBJECT = 'OBJECT',
441441
INTERFACE = 'INTERFACE',
@@ -445,6 +445,7 @@ export enum TypeKind {
445445
LIST = 'LIST',
446446
NON_NULL = 'NON_NULL',
447447
}
448+
export { TypeKind };
448449

449450
export const __TypeKind: GraphQLEnumType = new GraphQLEnumType({
450451
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';
3434
import { astFromValue } from './astFromValue';
3535
import { sortValueNode } from './sortValueNode';
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)