Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: type annotation cannot appear on a constructor declaration #2878

Merged
merged 1 commit into from Jan 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/error/GraphQLError.js
Expand Up @@ -83,7 +83,7 @@ export class GraphQLError extends Error {
path?: ?$ReadOnlyArray<string | number>,
originalError?: ?(Error & { +extensions?: mixed, ... }),
extensions?: ?{ [key: string]: mixed, ... },
): void {
) {
super(message);

// Compute list of blame nodes.
Expand Down
2 changes: 1 addition & 1 deletion src/language/source.js
Expand Up @@ -25,7 +25,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.js
Expand Up @@ -583,7 +583,7 @@ export class GraphQLScalarType {
astNode: ?ScalarTypeDefinitionNode;
extensionASTNodes: ?$ReadOnlyArray<ScalarTypeExtensionNode>;

constructor(config: $ReadOnly<GraphQLScalarTypeConfig<mixed, mixed>>): void {
constructor(config: $ReadOnly<GraphQLScalarTypeConfig<mixed, mixed>>) {
const parseValue = config.parseValue ?? identityFunc;
this.name = config.name;
this.description = config.description;
Expand Down Expand Up @@ -736,7 +736,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 @@ -1064,7 +1064,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 @@ -1183,7 +1183,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 @@ -1301,7 +1301,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 @@ -1523,7 +1523,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.js
Expand Up @@ -53,7 +53,7 @@ export class GraphQLDirective {
extensions: ?ReadOnlyObjMap<mixed>;
astNode: ?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.js
Expand Up @@ -142,7 +142,7 @@ export class GraphQLSchema {
// Used as a cache for validateSchema().
__validationErrors: ?$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.js
Expand Up @@ -64,7 +64,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.js
Expand Up @@ -50,7 +50,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 @@ -141,7 +141,7 @@ export class SDLValidationContext extends ASTValidationContext {
ast: DocumentNode,
schema: ?GraphQLSchema,
onError: (err: GraphQLError) => void,
): void {
) {
super(ast, onError);
this._schema = schema;
}
Expand All @@ -167,7 +167,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