Skip to content

Commit

Permalink
fix: Type annotation cannot appear on a constructor declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
saihaj committed Oct 27, 2020
1 parent 2c1b753 commit 4116d5e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/error/GraphQLError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class GraphQLError extends Error {
path?: Maybe<ReadonlyArray<string | number>>,
originalError?: Maybe<(Error & { readonly extensions?: unknown })>,
extensions?: Maybe<{ [key: string]: unknown }>,
): void {
) {
super(message);

// Compute list of blame nodes.
Expand Down
2 changes: 1 addition & 1 deletion src/language/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class Source {
body: string,
name: string = 'GraphQL request',
locationOffset: Location = { line: 1, column: 1 },
): void {
) {
devAssert(
typeof body === 'string',
`Body must be a string. Received: ${inspect(body)}.`,
Expand Down
12 changes: 6 additions & 6 deletions src/type/definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ export class GraphQLScalarType {
astNode: Maybe<ScalarTypeDefinitionNode>;
extensionASTNodes: Maybe<ReadonlyArray<ScalarTypeExtensionNode>>;

constructor(config: $ReadOnly<GraphQLScalarTypeConfig<unknown, unknown>>): void {
constructor(config: $ReadOnly<GraphQLScalarTypeConfig<unknown, unknown>>) {
const parseValue = config.parseValue ?? identityFunc;
this.name = config.name;
this.description = config.description;
Expand Down Expand Up @@ -699,7 +699,7 @@ export class GraphQLObjectType {
_fields: Thunk<GraphQLFieldMap<any, any>>;
_interfaces: Thunk<Array<GraphQLInterfaceType>>;

constructor(config: $ReadOnly<GraphQLObjectTypeConfig<any, any>>): void {
constructor(config: $ReadOnly<GraphQLObjectTypeConfig<any, any>>) {
this.name = config.name;
this.description = config.description;
this.isTypeOf = config.isTypeOf;
Expand Down Expand Up @@ -1013,7 +1013,7 @@ export class GraphQLInterfaceType {
_fields: Thunk<GraphQLFieldMap<any, any>>;
_interfaces: Thunk<Array<GraphQLInterfaceType>>;

constructor(config: $ReadOnly<GraphQLInterfaceTypeConfig<any, any>>): void {
constructor(config: $ReadOnly<GraphQLInterfaceTypeConfig<any, any>>) {
this.name = config.name;
this.description = config.description;
this.resolveType = config.resolveType;
Expand Down Expand Up @@ -1126,7 +1126,7 @@ export class GraphQLUnionType {

_types: Thunk<Array<GraphQLObjectType>>;

constructor(config: $ReadOnly<GraphQLUnionTypeConfig<any, any>>): void {
constructor(config: $ReadOnly<GraphQLUnionTypeConfig<any, any>>) {
this.name = config.name;
this.description = config.description;
this.resolveType = config.resolveType;
Expand Down Expand Up @@ -1238,7 +1238,7 @@ export class GraphQLEnumType /* <T> */ {
_valueLookup: Map<any /* T */, GraphQLEnumValue>;
_nameLookup: ObjMap<GraphQLEnumValue>;

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

_fields: Thunk<GraphQLInputFieldMap>;

constructor(config: $ReadOnly<GraphQLInputObjectTypeConfig>): void {
constructor(config: $ReadOnly<GraphQLInputObjectTypeConfig>) {
this.name = config.name;
this.description = config.description;
this.extensions = config.extensions && toObjMap(config.extensions);
Expand Down
2 changes: 1 addition & 1 deletion src/type/directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class GraphQLDirective {
extensions: Maybe<ReadOnlyObjMap<unknown>>;
astNode: Maybe<DirectiveDefinitionNode>;

constructor(config: $ReadOnly<GraphQLDirectiveConfig>): void {
constructor(config: $ReadOnly<GraphQLDirectiveConfig>) {
this.name = config.name;
this.description = config.description;
this.locations = config.locations;
Expand Down
2 changes: 1 addition & 1 deletion src/type/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class GraphQLSchema {
// Used as a cache for validateSchema().
__validationErrors: Maybe<ReadonlyArray<GraphQLError>>;

constructor(config: $ReadOnly<GraphQLSchemaConfig>): void {
constructor(config: $ReadOnly<GraphQLSchemaConfig>) {
// If this schema was built from a source known to be valid, then it may be
// marked with assumeValid to avoid an additional type system validation.
this.__validationErrors = config.assumeValid === true ? [] : undefined;
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/TypeInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class TypeInfo {
// Initial type may be provided in rare cases to facilitate traversals
// beginning somewhere other than documents.
initialType?: GraphQLType,
): void {
) {
this._schema = schema;
this._typeStack = [];
this._parentTypeStack = [];
Expand Down
6 changes: 3 additions & 3 deletions src/validation/ValidationContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class ASTValidationContext {
ReadonlyArray<FragmentDefinitionNode>
>;

constructor(ast: DocumentNode, onError: (err: GraphQLError) => void): void {
constructor(ast: DocumentNode, onError: (err: GraphQLError) => void) {
this._ast = ast;
this._fragments = undefined;
this._fragmentSpreads = new Map();
Expand Down Expand Up @@ -142,7 +142,7 @@ export class SDLValidationContext extends ASTValidationContext {
ast: DocumentNode,
schema: Maybe<GraphQLSchema>,
onError: (err: GraphQLError) => void,
): void {
) {
super(ast, onError);
this._schema = schema;
}
Expand All @@ -168,7 +168,7 @@ export class ValidationContext extends ASTValidationContext {
ast: DocumentNode,
typeInfo: TypeInfo,
onError: (err: GraphQLError) => void,
): void {
) {
super(ast, onError);
this._schema = schema;
this._typeInfo = typeInfo;
Expand Down

0 comments on commit 4116d5e

Please sign in to comment.