Skip to content

Commit e90d827

Browse files
TS: switch to 'Array<*>' style of array types (#2387)
1 parent f31f505 commit e90d827

File tree

8 files changed

+23
-23
lines changed

8 files changed

+23
-23
lines changed

.eslintrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ overrides:
446446
# Supported Rules
447447
# https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
448448
'@typescript-eslint/adjacent-overload-signatures': error
449-
'@typescript-eslint/array-type': off # TODO [error, { default: generic }]
449+
'@typescript-eslint/array-type': [error, { default: generic }]
450450
'@typescript-eslint/await-thenable': off # TODO error
451451
'@typescript-eslint/ban-ts-ignore': error
452452
'@typescript-eslint/ban-types': error

src/execution/execute.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface ExecutionContext {
3434
operation: OperationDefinitionNode;
3535
variableValues: { [key: string]: any };
3636
fieldResolver: GraphQLFieldResolver<any, any>;
37-
errors: GraphQLError[];
37+
errors: Array<GraphQLError>;
3838
}
3939

4040
export interface ExecutionResultDataDefault {

src/language/visitor.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export type VisitFn<TAnyNode, TVisitedNode = TAnyNode> = (
5252
export type VisitorKeyMap<T> = { [P in keyof T]: ReadonlyArray<keyof T[P]> };
5353

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

5757
export const QueryDocumentKeys: {
5858
Name: EmptyTuple;

src/type/definition.d.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,10 @@ export class GraphQLObjectType<
388388
);
389389

390390
getFields(): GraphQLFieldMap<any, TContext, TArgs>;
391-
getInterfaces(): GraphQLInterfaceType[];
391+
getInterfaces(): Array<GraphQLInterfaceType>;
392392

393393
toConfig(): GraphQLObjectTypeConfig<any, any> & {
394-
interfaces: GraphQLInterfaceType[];
394+
interfaces: Array<GraphQLInterfaceType>;
395395
fields: GraphQLFieldConfigMap<any, any>;
396396
extensions: Maybe<Readonly<Record<string, any>>>;
397397
extensionASTNodes: ReadonlyArray<ObjectTypeExtensionNode>;
@@ -414,7 +414,7 @@ export interface GraphQLObjectTypeConfig<
414414
> {
415415
name: string;
416416
description?: Maybe<string>;
417-
interfaces?: Thunk<Maybe<GraphQLInterfaceType[]>>;
417+
interfaces?: Thunk<Maybe<Array<GraphQLInterfaceType>>>;
418418
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext, TArgs>>;
419419
isTypeOf?: Maybe<GraphQLIsTypeOfFn<TSource, TContext>>;
420420
extensions?: Maybe<Readonly<Record<string, any>>>;
@@ -510,7 +510,7 @@ export interface GraphQLField<
510510
name: string;
511511
description: Maybe<string>;
512512
type: GraphQLOutputType;
513-
args: GraphQLArgument[];
513+
args: Array<GraphQLArgument>;
514514
resolve?: GraphQLFieldResolver<TSource, TContext, TArgs>;
515515
subscribe?: GraphQLFieldResolver<TSource, TContext, TArgs>;
516516
isDeprecated?: boolean;
@@ -567,10 +567,10 @@ export class GraphQLInterfaceType {
567567

568568
constructor(config: Readonly<GraphQLInterfaceTypeConfig<any, any>>);
569569
getFields(): GraphQLFieldMap<any, any>;
570-
getInterfaces(): GraphQLInterfaceType[];
570+
getInterfaces(): Array<GraphQLInterfaceType>;
571571

572572
toConfig(): GraphQLInterfaceTypeConfig<any, any> & {
573-
interfaces: GraphQLInterfaceType[];
573+
interfaces: Array<GraphQLInterfaceType>;
574574
fields: GraphQLFieldConfigMap<any, any>;
575575
extensions: Maybe<Readonly<Record<string, any>>>;
576576
extensionASTNodes: ReadonlyArray<InterfaceTypeExtensionNode>;
@@ -589,7 +589,7 @@ export interface GraphQLInterfaceTypeConfig<
589589
> {
590590
name: string;
591591
description?: Maybe<string>;
592-
interfaces?: Thunk<Maybe<GraphQLInterfaceType[]>>;
592+
interfaces?: Thunk<Maybe<Array<GraphQLInterfaceType>>>;
593593
fields: Thunk<GraphQLFieldConfigMap<TSource, TContext, TArgs>>;
594594
/**
595595
* Optionally provide a custom type resolver function. If one is not provided,
@@ -634,10 +634,10 @@ export class GraphQLUnionType {
634634
extensionASTNodes: Maybe<ReadonlyArray<UnionTypeExtensionNode>>;
635635

636636
constructor(config: Readonly<GraphQLUnionTypeConfig<any, any>>);
637-
getTypes(): GraphQLObjectType[];
637+
getTypes(): Array<GraphQLObjectType>;
638638

639639
toConfig(): GraphQLUnionTypeConfig<any, any> & {
640-
types: GraphQLObjectType[];
640+
types: Array<GraphQLObjectType>;
641641
extensions: Maybe<Readonly<Record<string, any>>>;
642642
extensionASTNodes: ReadonlyArray<UnionTypeExtensionNode>;
643643
};
@@ -650,7 +650,7 @@ export class GraphQLUnionType {
650650
export interface GraphQLUnionTypeConfig<TSource, TContext> {
651651
name: string;
652652
description?: Maybe<string>;
653-
types: Thunk<GraphQLObjectType[]>;
653+
types: Thunk<Array<GraphQLObjectType>>;
654654
/**
655655
* Optionally provide a custom type resolver function. If one is not provided,
656656
* the default implementation will call `isTypeOf` on each implementing
@@ -691,7 +691,7 @@ export class GraphQLEnumType {
691691
extensionASTNodes: Maybe<ReadonlyArray<EnumTypeExtensionNode>>;
692692

693693
constructor(config: Readonly<GraphQLEnumTypeConfig>);
694-
getValues(): GraphQLEnumValue[];
694+
getValues(): Array<GraphQLEnumValue>;
695695
getValue(name: string): Maybe<GraphQLEnumValue>;
696696
serialize(value: any): Maybe<string>;
697697
parseValue(value: any): Maybe<any>;

src/type/directives.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ export function assertDirective(directive: any): GraphQLDirective;
1717
export class GraphQLDirective {
1818
name: string;
1919
description: Maybe<string>;
20-
locations: DirectiveLocationEnum[];
20+
locations: Array<DirectiveLocationEnum>;
2121
isRepeatable: boolean;
22-
args: GraphQLArgument[];
22+
args: Array<GraphQLArgument>;
2323
extensions: Maybe<Readonly<Record<string, any>>>;
2424
astNode: Maybe<DirectiveDefinitionNode>;
2525

@@ -39,7 +39,7 @@ export class GraphQLDirective {
3939
export interface GraphQLDirectiveConfig {
4040
name: string;
4141
description?: Maybe<string>;
42-
locations: DirectiveLocationEnum[];
42+
locations: Array<DirectiveLocationEnum>;
4343
args?: Maybe<GraphQLFieldConfigArgumentMap>;
4444
isRepeatable?: Maybe<boolean>;
4545
extensions?: Maybe<Readonly<Record<string, any>>>;

src/type/schema.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ export class GraphQLSchema {
7777
getDirective(name: string): Maybe<GraphQLDirective>;
7878

7979
toConfig(): GraphQLSchemaConfig & {
80-
types: GraphQLNamedType[];
81-
directives: GraphQLDirective[];
80+
types: Array<GraphQLNamedType>;
81+
directives: Array<GraphQLDirective>;
8282
extensions: Maybe<Readonly<Record<string, any>>>;
8383
extensionASTNodes: ReadonlyArray<SchemaExtensionNode>;
8484
assumeValid: boolean;
@@ -107,8 +107,8 @@ export interface GraphQLSchemaConfig extends GraphQLSchemaValidationOptions {
107107
query: Maybe<GraphQLObjectType>;
108108
mutation?: Maybe<GraphQLObjectType>;
109109
subscription?: Maybe<GraphQLObjectType>;
110-
types?: Maybe<GraphQLNamedType[]>;
111-
directives?: Maybe<GraphQLDirective[]>;
110+
types?: Maybe<Array<GraphQLNamedType>>;
111+
directives?: Maybe<Array<GraphQLDirective>>;
112112
extensions?: Maybe<Readonly<Record<string, any>>>;
113113
astNode?: Maybe<SchemaDefinitionNode>;
114114
extensionASTNodes?: Maybe<ReadonlyArray<SchemaExtensionNode>>;

src/utilities/findDeprecatedUsages.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ import { GraphQLSchema } from '../type/schema';
1010
export function findDeprecatedUsages(
1111
schema: GraphQLSchema,
1212
ast: DocumentNode,
13-
): GraphQLError[];
13+
): Array<GraphQLError>;

src/validation/validate.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function validateSDL(
4141
documentAST: DocumentNode,
4242
schemaToExtend?: Maybe<GraphQLSchema>,
4343
rules?: ReadonlyArray<SDLValidationRule>,
44-
): GraphQLError[];
44+
): Array<GraphQLError>;
4545

4646
/**
4747
* Utility function which asserts a SDL document is valid by throwing an error

0 commit comments

Comments
 (0)