Skip to content

Commit 0afd200

Browse files
IvanGoncharovyaacovCR
authored andcommitted
Workaround for codesandbox having bug with TS enums (#3686)
1 parent be16adf commit 0afd200

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
@@ -345,11 +345,12 @@ export interface OperationDefinitionNode {
345345
readonly selectionSet: SelectionSetNode;
346346
}
347347

348-
export enum OperationTypeNode {
348+
enum OperationTypeNode {
349349
QUERY = 'query',
350350
MUTATION = 'mutation',
351351
SUBSCRIPTION = 'subscription',
352352
}
353+
export { OperationTypeNode };
353354

354355
export interface VariableDefinitionNode {
355356
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',
@@ -25,3 +25,5 @@ export enum DirectiveLocation {
2525
INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION',
2626
FRAGMENT_VARIABLE_DEFINITION = 'FRAGMENT_VARIABLE_DEFINITION',
2727
}
28+
29+
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

@@ -73,3 +73,5 @@ export enum Kind {
7373
ENUM_TYPE_EXTENSION = 'EnumTypeExtension',
7474
INPUT_OBJECT_TYPE_EXTENSION = 'InputObjectTypeExtension',
7575
}
76+
77+
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
@@ -447,7 +447,7 @@ export const __EnumValue: GraphQLObjectType = new GraphQLObjectType({
447447
} as GraphQLFieldConfigMap<GraphQLEnumValue, unknown>),
448448
});
449449

450-
export enum TypeKind {
450+
enum TypeKind {
451451
SCALAR = 'SCALAR',
452452
OBJECT = 'OBJECT',
453453
INTERFACE = 'INTERFACE',
@@ -457,6 +457,7 @@ export enum TypeKind {
457457
LIST = 'LIST',
458458
NON_NULL = 'NON_NULL',
459459
}
460+
export { TypeKind };
460461

461462
export const __TypeKind: GraphQLEnumType = new GraphQLEnumType({
462463
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)