Skip to content

Commit 502e720

Browse files
committed
remove inexact objects ... (flow)
1 parent 67fc118 commit 502e720

18 files changed

+39
-42
lines changed

src/__tests__/starWarsData.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ export type Character = {
66
id: string,
77
name: string,
88
friends: Array<string>,
9-
appearsIn: Array<number>,
10-
...
9+
appearsIn: Array<number>,
1110
};
1211

1312
export type Human = {

src/error/GraphQLError.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,16 @@ export class GraphQLError extends Error {
7373
/**
7474
* Extension fields to add to the formatted error.
7575
*/
76-
readonly extensions: { [key: string]: unknown, ... } | void;
76+
readonly extensions: { [key: string]: unknown } | void;
7777

7878
constructor(
7979
message: string,
8080
nodes?: ReadonlyArray<ASTNode> | ASTNode | void | null,
8181
source?: Maybe<Source>,
8282
positions?: Maybe<ReadonlyArray<number>>,
8383
path?: Maybe<ReadonlyArray<string | number>>,
84-
originalError?: Maybe<(Error & { readonly extensions?: unknown, ... })>,
85-
extensions?: Maybe<{ [key: string]: unknown, ... }>,
84+
originalError?: Maybe<(Error & { readonly extensions?: unknown })>,
85+
extensions?: Maybe<{ [key: string]: unknown }>,
8686
): void {
8787
super(message);
8888

src/error/formatError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ export type GraphQLFormattedError = {
4646
* Reserved for implementors to extend the protocol however they see fit,
4747
* and hence there are no additional restrictions on its contents.
4848
*/
49-
readonly extensions?: { [key: string]: unknown, ... },
49+
readonly extensions?: { [key: string]: unknown },
5050
};

src/execution/__tests__/variables-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const schema = new GraphQLSchema({ query: TestType });
119119

120120
function executeQuery(
121121
query: string,
122-
variableValues?: { [variable: string]: unknown, ... },
122+
variableValues?: { [variable: string]: unknown },
123123
) {
124124
const document = parse(query);
125125
return executeSync({ schema, document, variableValues });

src/execution/execute.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export type ExecutionContext = {
9999
rootValue: unknown,
100100
contextValue: unknown,
101101
operation: OperationDefinitionNode,
102-
variableValues: { [variable: string]: unknown, ... },
102+
variableValues: { [variable: string]: unknown },
103103
fieldResolver: GraphQLFieldResolver<any, any>,
104104
typeResolver: GraphQLTypeResolver<any, any>,
105105
errors: Array<GraphQLError>,
@@ -129,7 +129,7 @@ export type ExecutionArgs = {
129129
document: DocumentNode,
130130
rootValue?: unknown,
131131
contextValue?: unknown,
132-
variableValues?: Maybe<{ readonly [variable: string]: unknown, ... }>,
132+
variableValues?: Maybe<{ readonly [variable: string]: unknown }>,
133133
operationName?: Maybe<string>,
134134
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,
135135
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,
@@ -230,7 +230,7 @@ function buildResponse(
230230
export function assertValidExecutionArguments(
231231
schema: GraphQLSchema,
232232
document: DocumentNode,
233-
rawVariableValues: Maybe<{ readonly [variable: string]: unknown, ... }>,
233+
rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>,
234234
): void {
235235
devAssert(document, 'Must provide document.');
236236

@@ -257,7 +257,7 @@ export function buildExecutionContext(
257257
document: DocumentNode,
258258
rootValue: unknown,
259259
contextValue: unknown,
260-
rawVariableValues: Maybe<{ readonly [variable: string]: unknown, ... }>,
260+
rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>,
261261
operationName: Maybe<string>,
262262
fieldResolver: Maybe<GraphQLFieldResolver<unknown, unknown>>,
263263
typeResolver?: Maybe<GraphQLTypeResolver<unknown, unknown>>,

src/execution/values.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { Maybe } from '../jsutils/Maybe';
2525

2626
type CoercedVariableValues =
2727
| { errors: ReadonlyArray<GraphQLError> }
28-
| { coerced: { [variable: string]: unknown, ... } };
28+
| { coerced: { [variable: string]: unknown } };
2929

3030
/**
3131
* Prepares an object map of variableValues of the correct type based on the
@@ -41,7 +41,7 @@ type CoercedVariableValues =
4141
export function getVariableValues(
4242
schema: GraphQLSchema,
4343
varDefNodes: ReadonlyArray<VariableDefinitionNode>,
44-
inputs: { readonly [variable: string]: unknown, ... },
44+
inputs: { readonly [variable: string]: unknown },
4545
options?: { maxErrors?: number },
4646
): CoercedVariableValues {
4747
const errors = [];
@@ -74,9 +74,9 @@ export function getVariableValues(
7474
function coerceVariableValues(
7575
schema: GraphQLSchema,
7676
varDefNodes: ReadonlyArray<VariableDefinitionNode>,
77-
inputs: { readonly [variable: string]: unknown, ... },
77+
inputs: { readonly [variable: string]: unknown },
7878
onError: (GraphQLError) => void,
79-
): { [variable: string]: unknown, ... } {
79+
): { [variable: string]: unknown } {
8080
const coercedValues = {};
8181
for (const varDefNode of varDefNodes) {
8282
const varName = varDefNode.variable.name.value;
@@ -160,8 +160,8 @@ function coerceVariableValues(
160160
export function getArgumentValues(
161161
def: GraphQLField<unknown, unknown> | GraphQLDirective,
162162
node: FieldNode | DirectiveNode,
163-
variableValues?: ?ObjMap<unknown>,
164-
): { [argument: string]: unknown, ... } {
163+
variableValues?: ObjMap<unknown>,
164+
): { [argument: string]: unknown } {
165165
const coercedValues = {};
166166

167167
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
@@ -245,9 +245,9 @@ export function getArgumentValues(
245245
*/
246246
export function getDirectiveValues(
247247
directiveDef: GraphQLDirective,
248-
node: { readonly directives?: ReadonlyArray<DirectiveNode>, ... },
248+
node: { readonly directives?: ReadonlyArray<DirectiveNode> },
249249
variableValues?: Maybe<ObjMap<unknown>>,
250-
): void | { [argument: string]: unknown, ... } {
250+
): void | { [argument: string]: unknown } {
251251
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
252252
const directiveNode = node.directives?.find(
253253
(directive) => directive.name.value === directiveDef.name,

src/graphql.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export type GraphQLArgs = {
6161
source: string | Source,
6262
rootValue?: unknown,
6363
contextValue?: unknown,
64-
variableValues?: Maybe<{ readonly [variable: string]: unknown, ... }>,
64+
variableValues?: Maybe<{ readonly [variable: string]: unknown }>,
6565
operationName?: Maybe<string>,
6666
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,
6767
typeResolver?: Maybe<GraphQLTypeResolver<any, any>>,

src/jsutils/ObjMap.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
export type ObjMap<T> = { [key: string]: T, __proto__: null, ... };
2-
export type ObjMapLike<T> = ObjMap<T> | { [key: string]: T, ... };
1+
export type ObjMap<T> = { [key: string]: T, __proto__: null };
2+
export type ObjMapLike<T> = ObjMap<T> | { [key: string]: T };
33

4-
export type ReadOnlyObjMap<T> = { readonly [key: string]: T, __proto__: null, ... };
4+
export type ReadOnlyObjMap<T> = { readonly [key: string]: T, __proto__: null };
55
export type ReadOnlyObjMapLike<T> =
66
| ReadOnlyObjMap<T>
7-
| { readonly [key: string]: T, ... };
7+
| { readonly [key: string]: T };

src/subscription/subscribe.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export type SubscriptionArgs = {
3131
document: DocumentNode,
3232
rootValue?: unknown,
3333
contextValue?: unknown,
34-
variableValues?: Maybe<{ readonly [variable: string]: unknown, ... }>,
34+
variableValues?: Maybe<{ readonly [variable: string]: unknown }>,
3535
operationName?: Maybe<string>,
3636
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,
3737
subscribeFieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,
@@ -158,7 +158,7 @@ export function createSourceEventStream(
158158
document: DocumentNode,
159159
rootValue?: unknown,
160160
contextValue?: unknown,
161-
variableValues?: Maybe<{ readonly [variable: string]: unknown, ... }>,
161+
variableValues?: Maybe<{ readonly [variable: string]: unknown }>,
162162
operationName?: Maybe<string>,
163163
fieldResolver?: Maybe<GraphQLFieldResolver<any, any>>,
164164
): Promise<AsyncIterable<unknown> | ExecutionResult> {

src/type/__tests__/enumType-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const schema = new GraphQLSchema({
114114

115115
function executeQuery(
116116
source: string,
117-
variableValues?: { readonly [variable: string]: unknown, ... },
117+
variableValues?: { readonly [variable: string]: unknown },
118118
) {
119119
return graphqlSync({ schema, source, variableValues });
120120
}

src/type/definition.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,7 @@ export type GraphQLIsTypeOfFn<TSource, TContext> = (
909909
export type GraphQLFieldResolver<
910910
TSource,
911911
TContext,
912-
TArgs = { [argument: string]: any, ... },
912+
TArgs = { [argument: string]: any },
913913
> = (
914914
source: TSource,
915915
args: TArgs,
@@ -927,13 +927,13 @@ export type GraphQLResolveInfo = {
927927
readonly fragments: ObjMap<FragmentDefinitionNode>,
928928
readonly rootValue: unknown,
929929
readonly operation: OperationDefinitionNode,
930-
readonly variableValues: { [variable: string]: unknown, ... },
930+
readonly variableValues: { [variable: string]: unknown },
931931
};
932932

933933
export type GraphQLFieldConfig<
934934
TSource,
935935
TContext,
936-
TArgs = { [argument: string]: any, ... },
936+
TArgs = { [argument: string]: any },
937937
> = {
938938
description?: Maybe<string>,
939939
type: GraphQLOutputType,
@@ -963,7 +963,7 @@ export type GraphQLFieldConfigMap<TSource, TContext> = ObjMap<
963963
export type GraphQLField<
964964
TSource,
965965
TContext,
966-
TArgs = { [argument: string]: any, ... },
966+
TArgs = { [argument: string]: any },
967967
> = {
968968
name: string,
969969
description: Maybe<string>,

src/type/validate.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ function validateDirectives(context: SchemaValidationContext): void {
201201

202202
function validateName(
203203
context: SchemaValidationContext,
204-
node: { readonly name: string, readonly astNode: Maybe<ASTNode>, ... },
204+
node: { readonly name: string, readonly astNode: Maybe<ASTNode> },
205205
): void {
206206
// Ensure names are valid, however introspection types opt out.
207207
const error = isValidNameError(node.name);
@@ -613,9 +613,8 @@ function createInputObjectCircularRefsValidator(
613613
}
614614

615615
type SDLDefinedObject<T, K> = {
616-
+astNode: Maybe<T>,
617-
+extensionASTNodes?: Maybe<ReadonlyArray<K>>,
618-
...
616+
readonly astNode: Maybe<T>,
617+
readonly extensionASTNodes?: Maybe<ReadonlyArray<K>>,
619618
};
620619

621620
function getAllNodes<T: ASTNode, K: ASTNode>(
@@ -660,7 +659,7 @@ function getUnionMemberTypeNodes(
660659
}
661660

662661
function getDeprecatedDirectiveNode(
663-
definitionNode: Maybe<{ readonly directives?: ReadonlyArray<DirectiveNode>, ... }>,
662+
definitionNode: Maybe<{ readonly directives?: ReadonlyArray<DirectiveNode> }>,
664663
): Maybe<DirectiveNode> {
665664
// istanbul ignore next (See: 'https://github.com/graphql/graphql-js/issues/2203')
666665
return definitionNode?.directives?.find(

src/utilities/__tests__/buildASTSchema-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function cycleSDL(sdl: string): string {
5252
return printSchema(buildSchema(sdl));
5353
}
5454

55-
function printASTNode(obj: Maybe<{ readonly astNode: Maybe<ASTNode>, ... }>): string {
55+
function printASTNode(obj: Maybe<{ readonly astNode: Maybe<ASTNode> }>): string {
5656
invariant(obj?.astNode != null);
5757
return print(obj.astNode);
5858
}

src/utilities/__tests__/extendSchema-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function printSchemaChanges(
6060
});
6161
}
6262

63-
function printASTNode(obj: Maybe<{ readonly astNode: Maybe<ASTNode>, ... }>): string {
63+
function printASTNode(obj: Maybe<{ readonly astNode: Maybe<ASTNode> }>): string {
6464
invariant(obj?.astNode != null);
6565
return print(obj.astNode);
6666
}

src/utilities/findBreakingChanges.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ function stringifyValue(value: unknown, type: GraphQLInputType): string {
551551
return print(sortedAST);
552552
}
553553

554-
function diff<T: { name: string, ... }>(
554+
function diff<T: { name: string }>(
555555
oldArray: ReadonlyArray<T>,
556556
newArray: ReadonlyArray<T>,
557557
): {

src/utilities/lexicographicSortSchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ function sortObjMap<T, R>(map: ObjMap<T>, sortValueFn?: (T) => R): ObjMap<R> {
168168
return sortedMap;
169169
}
170170

171-
function sortByName<T: { readonly name: string, ... }>(
171+
function sortByName<T: { readonly name: string }>(
172172
array: ReadonlyArray<T>,
173173
): Array<T> {
174174
return sortBy(array, (obj) => obj.name);

src/utilities/printSchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ function printSpecifiedByUrl(scalar: GraphQLScalarType): string {
307307
}
308308

309309
function printDescription(
310-
def: { readonly description: Maybe<string>, ... },
310+
def: { readonly description: Maybe<string> },
311311
indentation: string = '',
312312
firstInBlock: boolean = true,
313313
): string {

src/validation/rules/UniqueFieldDefinitionNamesRule.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export function UniqueFieldDefinitionNamesRule(
4040
function checkFieldUniqueness(node: {
4141
readonly name: NameNode,
4242
readonly fields?: ReadonlyArray<InputValueDefinitionNode | FieldDefinitionNode>,
43-
...
4443
}) {
4544
const typeName = node.name.value;
4645

0 commit comments

Comments
 (0)