Skip to content

Commit

Permalink
Workaround for codesandbox having bug with TS enums (#3686)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored Aug 16, 2022
1 parent 59a73d6 commit af8221a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/language/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,12 @@ export interface OperationDefinitionNode {
readonly selectionSet: SelectionSetNode;
}

export enum OperationTypeNode {
enum OperationTypeNode {
QUERY = 'query',
MUTATION = 'mutation',
SUBSCRIPTION = 'subscription',
}
export { OperationTypeNode };

export interface VariableDefinitionNode {
readonly kind: Kind.VARIABLE_DEFINITION;
Expand Down
3 changes: 2 additions & 1 deletion src/language/directiveLocation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* The set of allowed directive location values.
*/
export enum DirectiveLocation {
enum DirectiveLocation {
/** Request Definitions */
QUERY = 'QUERY',
MUTATION = 'MUTATION',
Expand All @@ -24,6 +24,7 @@ export enum DirectiveLocation {
INPUT_OBJECT = 'INPUT_OBJECT',
INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION',
}
export { DirectiveLocation };

/**
* The enum type representing the directive location values.
Expand Down
3 changes: 2 additions & 1 deletion src/language/kinds.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* The set of allowed kind values for AST nodes.
*/
export enum Kind {
enum Kind {
/** Name */
NAME = 'Name',

Expand Down Expand Up @@ -67,6 +67,7 @@ export enum Kind {
ENUM_TYPE_EXTENSION = 'EnumTypeExtension',
INPUT_OBJECT_TYPE_EXTENSION = 'InputObjectTypeExtension',
}
export { Kind };

/**
* The enum type representing the possible kind values of AST nodes.
Expand Down
3 changes: 2 additions & 1 deletion src/language/tokenKind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* An exported enum describing the different kinds of tokens that the
* lexer emits.
*/
export enum TokenKind {
enum TokenKind {
SOF = '<SOF>',
EOF = '<EOF>',
BANG = '!',
Expand All @@ -26,6 +26,7 @@ export enum TokenKind {
BLOCK_STRING = 'BlockString',
COMMENT = 'Comment',
}
export { TokenKind };

/**
* The enum type representing the token kinds values.
Expand Down
3 changes: 2 additions & 1 deletion src/type/introspection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ export const __EnumValue: GraphQLObjectType = new GraphQLObjectType({
} as GraphQLFieldConfigMap<GraphQLEnumValue, unknown>),
});

export enum TypeKind {
enum TypeKind {
SCALAR = 'SCALAR',
OBJECT = 'OBJECT',
INTERFACE = 'INTERFACE',
Expand All @@ -445,6 +445,7 @@ export enum TypeKind {
LIST = 'LIST',
NON_NULL = 'NON_NULL',
}
export { TypeKind };

export const __TypeKind: GraphQLEnumType = new GraphQLEnumType({
name: '__TypeKind',
Expand Down
6 changes: 4 additions & 2 deletions src/utilities/findBreakingChanges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import type { GraphQLSchema } from '../type/schema';
import { astFromValue } from './astFromValue';
import { sortValueNode } from './sortValueNode';

export enum BreakingChangeType {
enum BreakingChangeType {
TYPE_REMOVED = 'TYPE_REMOVED',
TYPE_CHANGED_KIND = 'TYPE_CHANGED_KIND',
TYPE_REMOVED_FROM_UNION = 'TYPE_REMOVED_FROM_UNION',
Expand All @@ -52,15 +52,17 @@ export enum BreakingChangeType {
DIRECTIVE_REPEATABLE_REMOVED = 'DIRECTIVE_REPEATABLE_REMOVED',
DIRECTIVE_LOCATION_REMOVED = 'DIRECTIVE_LOCATION_REMOVED',
}
export { BreakingChangeType };

export enum DangerousChangeType {
enum DangerousChangeType {
VALUE_ADDED_TO_ENUM = 'VALUE_ADDED_TO_ENUM',
TYPE_ADDED_TO_UNION = 'TYPE_ADDED_TO_UNION',
OPTIONAL_INPUT_FIELD_ADDED = 'OPTIONAL_INPUT_FIELD_ADDED',
OPTIONAL_ARG_ADDED = 'OPTIONAL_ARG_ADDED',
IMPLEMENTED_INTERFACE_ADDED = 'IMPLEMENTED_INTERFACE_ADDED',
ARG_DEFAULT_VALUE_CHANGE = 'ARG_DEFAULT_VALUE_CHANGE',
}
export { DangerousChangeType };

export interface BreakingChange {
type: BreakingChangeType;
Expand Down

0 comments on commit af8221a

Please sign in to comment.