Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts: use typeof instead of private types #2584

Merged
merged 1 commit into from
May 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/language/directiveLocation.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/**
* The set of allowed directive location values.
*/
export const DirectiveLocation: _DirectiveLocation;

/**
* @internal
*/
type _DirectiveLocation = {
export const DirectiveLocation: {
// Request Definitions
QUERY: 'QUERY';
MUTATION: 'MUTATION';
Expand Down Expand Up @@ -34,4 +29,4 @@ type _DirectiveLocation = {
/**
* The enum type representing the directive location values.
*/
export type DirectiveLocationEnum = _DirectiveLocation[keyof _DirectiveLocation];
export type DirectiveLocationEnum = typeof DirectiveLocation[keyof typeof DirectiveLocation];
9 changes: 2 additions & 7 deletions src/language/kinds.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/**
* The set of allowed kind values for AST nodes.
*/
export const Kind: _Kind;

/**
* @internal
*/
type _Kind = {
export const Kind: {
// Name
NAME: 'Name';

Expand Down Expand Up @@ -76,4 +71,4 @@ type _Kind = {
/**
* The enum type representing the possible kind values of AST nodes.
*/
export type KindEnum = _Kind[keyof _Kind];
export type KindEnum = typeof Kind[keyof typeof Kind];
6 changes: 2 additions & 4 deletions src/language/tokenKind.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
* An exported enum describing the different kinds of tokens that the
* lexer emits.
*/
export const TokenKind: _TokenKind;

type _TokenKind = {
export const TokenKind: {
SOF: '<SOF>';
EOF: '<EOF>';
BANG: '!';
Expand Down Expand Up @@ -32,4 +30,4 @@ type _TokenKind = {
/**
* The enum type representing the token kinds values.
*/
export type TokenKindEnum = _TokenKind[keyof _TokenKind];
export type TokenKindEnum = typeof TokenKind[keyof typeof TokenKind];
18 changes: 4 additions & 14 deletions src/utilities/findBreakingChanges.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { GraphQLSchema } from '../type/schema';

export const BreakingChangeType: _BreakingChangeType;

/**
* @internal
*/
type _BreakingChangeType = {
export const BreakingChangeType: {
TYPE_REMOVED: 'TYPE_REMOVED';
TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND';
TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION';
Expand All @@ -24,12 +19,7 @@ type _BreakingChangeType = {
DIRECTIVE_LOCATION_REMOVED: 'DIRECTIVE_LOCATION_REMOVED';
};

export const DangerousChangeType: _DangerousChangeType;

/**
* @internal
*/
type _DangerousChangeType = {
export const 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';
Expand All @@ -39,12 +29,12 @@ type _DangerousChangeType = {
};

export interface BreakingChange {
type: keyof _BreakingChangeType;
type: keyof typeof BreakingChangeType;
description: string;
}

export interface DangerousChange {
type: keyof _DangerousChangeType;
type: keyof typeof DangerousChangeType;
description: string;
}

Expand Down