Skip to content

Commit 79accec

Browse files
committed
fix: Type annotation cannot appear on a constructor declaration
1 parent d6b6fcc commit 79accec

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

src/error/GraphQLError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class GraphQLError extends Error {
8383
path?: Maybe<ReadonlyArray<string | number>>,
8484
originalError?: Maybe<(Error & { readonly extensions?: unknown })>,
8585
extensions?: Maybe<{ [key: string]: unknown }>,
86-
): void {
86+
) {
8787
super(message);
8888

8989
// Compute list of blame nodes.

src/language/source.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class Source {
2323
body: string,
2424
name: string = 'GraphQL request',
2525
locationOffset: Location = { line: 1, column: 1 },
26-
): void {
26+
) {
2727
devAssert(
2828
typeof body === 'string',
2929
`Body must be a string. Received: ${inspect(body)}.`,

src/type/definition.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ export class GraphQLScalarType {
552552
astNode: Maybe<ScalarTypeDefinitionNode>;
553553
extensionASTNodes: Maybe<ReadonlyArray<ScalarTypeExtensionNode>>;
554554

555-
constructor(config: $ReadOnly<GraphQLScalarTypeConfig<unknown, unknown>>): void {
555+
constructor(config: $ReadOnly<GraphQLScalarTypeConfig<unknown, unknown>>) {
556556
const parseValue = config.parseValue ?? identityFunc;
557557
this.name = config.name;
558558
this.description = config.description;
@@ -699,7 +699,7 @@ export class GraphQLObjectType {
699699
_fields: Thunk<GraphQLFieldMap<any, any>>;
700700
_interfaces: Thunk<Array<GraphQLInterfaceType>>;
701701

702-
constructor(config: $ReadOnly<GraphQLObjectTypeConfig<any, any>>): void {
702+
constructor(config: $ReadOnly<GraphQLObjectTypeConfig<any, any>>) {
703703
this.name = config.name;
704704
this.description = config.description;
705705
this.isTypeOf = config.isTypeOf;
@@ -1013,7 +1013,7 @@ export class GraphQLInterfaceType {
10131013
_fields: Thunk<GraphQLFieldMap<any, any>>;
10141014
_interfaces: Thunk<Array<GraphQLInterfaceType>>;
10151015

1016-
constructor(config: $ReadOnly<GraphQLInterfaceTypeConfig<any, any>>): void {
1016+
constructor(config: $ReadOnly<GraphQLInterfaceTypeConfig<any, any>>) {
10171017
this.name = config.name;
10181018
this.description = config.description;
10191019
this.resolveType = config.resolveType;
@@ -1126,7 +1126,7 @@ export class GraphQLUnionType {
11261126

11271127
_types: Thunk<Array<GraphQLObjectType>>;
11281128

1129-
constructor(config: $ReadOnly<GraphQLUnionTypeConfig<any, any>>): void {
1129+
constructor(config: $ReadOnly<GraphQLUnionTypeConfig<any, any>>) {
11301130
this.name = config.name;
11311131
this.description = config.description;
11321132
this.resolveType = config.resolveType;
@@ -1238,7 +1238,7 @@ export class GraphQLEnumType /* <T> */ {
12381238
_valueLookup: Map<any /* T */, GraphQLEnumValue>;
12391239
_nameLookup: ObjMap<GraphQLEnumValue>;
12401240

1241-
constructor(config: $ReadOnly<GraphQLEnumTypeConfig /* <T> */>): void {
1241+
constructor(config: $ReadOnly<GraphQLEnumTypeConfig /* <T> */>) {
12421242
this.name = config.name;
12431243
this.description = config.description;
12441244
this.extensions = config.extensions && toObjMap(config.extensions);
@@ -1446,7 +1446,7 @@ export class GraphQLInputObjectType {
14461446

14471447
_fields: Thunk<GraphQLInputFieldMap>;
14481448

1449-
constructor(config: $ReadOnly<GraphQLInputObjectTypeConfig>): void {
1449+
constructor(config: $ReadOnly<GraphQLInputObjectTypeConfig>) {
14501450
this.name = config.name;
14511451
this.description = config.description;
14521452
this.extensions = config.extensions && toObjMap(config.extensions);

src/type/directives.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class GraphQLDirective {
5252
extensions: Maybe<ReadOnlyObjMap<unknown>>;
5353
astNode: Maybe<DirectiveDefinitionNode>;
5454

55-
constructor(config: $ReadOnly<GraphQLDirectiveConfig>): void {
55+
constructor(config: $ReadOnly<GraphQLDirectiveConfig>) {
5656
this.name = config.name;
5757
this.description = config.description;
5858
this.locations = config.locations;

src/type/schema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export class GraphQLSchema {
139139
// Used as a cache for validateSchema().
140140
__validationErrors: Maybe<ReadonlyArray<GraphQLError>>;
141141

142-
constructor(config: $ReadOnly<GraphQLSchemaConfig>): void {
142+
constructor(config: $ReadOnly<GraphQLSchemaConfig>) {
143143
// If this schema was built from a source known to be valid, then it may be
144144
// marked with assumeValid to avoid an additional type system validation.
145145
this.__validationErrors = config.assumeValid === true ? [] : undefined;

src/utilities/TypeInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class TypeInfo {
6363
// Initial type may be provided in rare cases to facilitate traversals
6464
// beginning somewhere other than documents.
6565
initialType?: GraphQLType,
66-
): void {
66+
) {
6767
this._schema = schema;
6868
this._typeStack = [];
6969
this._parentTypeStack = [];

src/validation/ValidationContext.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class ASTValidationContext {
5151
ReadonlyArray<FragmentDefinitionNode>
5252
>;
5353

54-
constructor(ast: DocumentNode, onError: (err: GraphQLError) => void): void {
54+
constructor(ast: DocumentNode, onError: (err: GraphQLError) => void) {
5555
this._ast = ast;
5656
this._fragments = undefined;
5757
this._fragmentSpreads = new Map();
@@ -142,7 +142,7 @@ export class SDLValidationContext extends ASTValidationContext {
142142
ast: DocumentNode,
143143
schema: Maybe<GraphQLSchema>,
144144
onError: (err: GraphQLError) => void,
145-
): void {
145+
) {
146146
super(ast, onError);
147147
this._schema = schema;
148148
}
@@ -168,7 +168,7 @@ export class ValidationContext extends ASTValidationContext {
168168
ast: DocumentNode,
169169
typeInfo: TypeInfo,
170170
onError: (err: GraphQLError) => void,
171-
): void {
171+
) {
172172
super(ast, onError);
173173
this._schema = schema;
174174
this._typeInfo = typeInfo;

0 commit comments

Comments
 (0)