Skip to content

Commit

Permalink
TS: switch to 'Array<*>' style of array types (#2387)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored Jan 24, 2020
1 parent f31f505 commit e90d827
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ overrides:
# Supported Rules
# https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
'@typescript-eslint/adjacent-overload-signatures': error
'@typescript-eslint/array-type': off # TODO [error, { default: generic }]
'@typescript-eslint/array-type': [error, { default: generic }]
'@typescript-eslint/await-thenable': off # TODO error
'@typescript-eslint/ban-ts-ignore': error
'@typescript-eslint/ban-types': error
Expand Down
2 changes: 1 addition & 1 deletion src/execution/execute.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export interface ExecutionContext {
operation: OperationDefinitionNode;
variableValues: { [key: string]: any };
fieldResolver: GraphQLFieldResolver<any, any>;
errors: GraphQLError[];
errors: Array<GraphQLError>;
}

export interface ExecutionResultDataDefault {
Expand Down
2 changes: 1 addition & 1 deletion src/language/visitor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export type VisitFn<TAnyNode, TVisitedNode = TAnyNode> = (
export type VisitorKeyMap<T> = { [P in keyof T]: ReadonlyArray<keyof T[P]> };

// TODO: Should be `[]`, but that requires TypeScript@3
type EmptyTuple = never[];
type EmptyTuple = Array<never>;

export const QueryDocumentKeys: {
Name: EmptyTuple;
Expand Down
22 changes: 11 additions & 11 deletions src/type/definition.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,10 @@ export class GraphQLObjectType<
);

getFields(): GraphQLFieldMap<any, TContext, TArgs>;
getInterfaces(): GraphQLInterfaceType[];
getInterfaces(): Array<GraphQLInterfaceType>;

toConfig(): GraphQLObjectTypeConfig<any, any> & {
interfaces: GraphQLInterfaceType[];
interfaces: Array<GraphQLInterfaceType>;
fields: GraphQLFieldConfigMap<any, any>;
extensions: Maybe<Readonly<Record<string, any>>>;
extensionASTNodes: ReadonlyArray<ObjectTypeExtensionNode>;
Expand All @@ -414,7 +414,7 @@ export interface GraphQLObjectTypeConfig<
> {
name: string;
description?: Maybe<string>;
interfaces?: Thunk<Maybe<GraphQLInterfaceType[]>>;
interfaces?: Thunk<Maybe<Array<GraphQLInterfaceType>>>;
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext, TArgs>>;
isTypeOf?: Maybe<GraphQLIsTypeOfFn<TSource, TContext>>;
extensions?: Maybe<Readonly<Record<string, any>>>;
Expand Down Expand Up @@ -510,7 +510,7 @@ export interface GraphQLField<
name: string;
description: Maybe<string>;
type: GraphQLOutputType;
args: GraphQLArgument[];
args: Array<GraphQLArgument>;
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>;
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>;
isDeprecated?: boolean;
Expand Down Expand Up @@ -567,10 +567,10 @@ export class GraphQLInterfaceType {

constructor(config: Readonly<GraphQLInterfaceTypeConfig<any, any>>);
getFields(): GraphQLFieldMap<any, any>;
getInterfaces(): GraphQLInterfaceType[];
getInterfaces(): Array<GraphQLInterfaceType>;

toConfig(): GraphQLInterfaceTypeConfig<any, any> & {
interfaces: GraphQLInterfaceType[];
interfaces: Array<GraphQLInterfaceType>;
fields: GraphQLFieldConfigMap<any, any>;
extensions: Maybe<Readonly<Record<string, any>>>;
extensionASTNodes: ReadonlyArray<InterfaceTypeExtensionNode>;
Expand All @@ -589,7 +589,7 @@ export interface GraphQLInterfaceTypeConfig<
> {
name: string;
description?: Maybe<string>;
interfaces?: Thunk<Maybe<GraphQLInterfaceType[]>>;
interfaces?: Thunk<Maybe<Array<GraphQLInterfaceType>>>;
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext, TArgs>>;
/**
* Optionally provide a custom type resolver function. If one is not provided,
Expand Down Expand Up @@ -634,10 +634,10 @@ export class GraphQLUnionType {
extensionASTNodes: Maybe<ReadonlyArray<UnionTypeExtensionNode>>;

constructor(config: Readonly<GraphQLUnionTypeConfig<any, any>>);
getTypes(): GraphQLObjectType[];
getTypes(): Array<GraphQLObjectType>;

toConfig(): GraphQLUnionTypeConfig<any, any> & {
types: GraphQLObjectType[];
types: Array<GraphQLObjectType>;
extensions: Maybe<Readonly<Record<string, any>>>;
extensionASTNodes: ReadonlyArray<UnionTypeExtensionNode>;
};
Expand All @@ -650,7 +650,7 @@ export class GraphQLUnionType {
export interface GraphQLUnionTypeConfig<TSource, TContext> {
name: string;
description?: Maybe<string>;
types: Thunk<GraphQLObjectType[]>;
types: Thunk<Array<GraphQLObjectType>>;
/**
* Optionally provide a custom type resolver function. If one is not provided,
* the default implementation will call `isTypeOf` on each implementing
Expand Down Expand Up @@ -691,7 +691,7 @@ export class GraphQLEnumType {
extensionASTNodes: Maybe<ReadonlyArray<EnumTypeExtensionNode>>;

constructor(config: Readonly<GraphQLEnumTypeConfig>);
getValues(): GraphQLEnumValue[];
getValues(): Array<GraphQLEnumValue>;
getValue(name: string): Maybe<GraphQLEnumValue>;
serialize(value: any): Maybe<string>;
parseValue(value: any): Maybe<any>;
Expand Down
6 changes: 3 additions & 3 deletions src/type/directives.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export function assertDirective(directive: any): GraphQLDirective;
export class GraphQLDirective {
name: string;
description: Maybe<string>;
locations: DirectiveLocationEnum[];
locations: Array<DirectiveLocationEnum>;
isRepeatable: boolean;
args: GraphQLArgument[];
args: Array<GraphQLArgument>;
extensions: Maybe<Readonly<Record<string, any>>>;
astNode: Maybe<DirectiveDefinitionNode>;

Expand All @@ -39,7 +39,7 @@ export class GraphQLDirective {
export interface GraphQLDirectiveConfig {
name: string;
description?: Maybe<string>;
locations: DirectiveLocationEnum[];
locations: Array<DirectiveLocationEnum>;
args?: Maybe<GraphQLFieldConfigArgumentMap>;
isRepeatable?: Maybe<boolean>;
extensions?: Maybe<Readonly<Record<string, any>>>;
Expand Down
8 changes: 4 additions & 4 deletions src/type/schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export class GraphQLSchema {
getDirective(name: string): Maybe<GraphQLDirective>;

toConfig(): GraphQLSchemaConfig & {
types: GraphQLNamedType[];
directives: GraphQLDirective[];
types: Array<GraphQLNamedType>;
directives: Array<GraphQLDirective>;
extensions: Maybe<Readonly<Record<string, any>>>;
extensionASTNodes: ReadonlyArray<SchemaExtensionNode>;
assumeValid: boolean;
Expand Down Expand Up @@ -107,8 +107,8 @@ export interface GraphQLSchemaConfig extends GraphQLSchemaValidationOptions {
query: Maybe<GraphQLObjectType>;
mutation?: Maybe<GraphQLObjectType>;
subscription?: Maybe<GraphQLObjectType>;
types?: Maybe<GraphQLNamedType[]>;
directives?: Maybe<GraphQLDirective[]>;
types?: Maybe<Array<GraphQLNamedType>>;
directives?: Maybe<Array<GraphQLDirective>>;
extensions?: Maybe<Readonly<Record<string, any>>>;
astNode?: Maybe<SchemaDefinitionNode>;
extensionASTNodes?: Maybe<ReadonlyArray<SchemaExtensionNode>>;
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/findDeprecatedUsages.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ import { GraphQLSchema } from '../type/schema';
export function findDeprecatedUsages(
schema: GraphQLSchema,
ast: DocumentNode,
): GraphQLError[];
): Array<GraphQLError>;
2 changes: 1 addition & 1 deletion src/validation/validate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function validateSDL(
documentAST: DocumentNode,
schemaToExtend?: Maybe<GraphQLSchema>,
rules?: ReadonlyArray<SDLValidationRule>,
): GraphQLError[];
): Array<GraphQLError>;

/**
* Utility function which asserts a SDL document is valid by throwing an error
Expand Down

0 comments on commit e90d827

Please sign in to comment.