Skip to content

Commit c3292db

Browse files
Remove some unneeded 'any' (#1448)
1 parent 9f7faaa commit c3292db

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

src/error/GraphQLError.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export function GraphQLError( // eslint-disable-line no-redeclare
9595
source?: ?Source,
9696
positions?: ?$ReadOnlyArray<number>,
9797
path?: ?$ReadOnlyArray<string | number>,
98-
originalError?: ?Error,
98+
originalError?: ?Error & { +extensions: mixed },
9999
extensions?: ?{ [key: string]: mixed },
100100
) {
101101
// Compute list of blame nodes.
@@ -139,8 +139,7 @@ export function GraphQLError( // eslint-disable-line no-redeclare
139139
}, []);
140140
}
141141

142-
const _extensions =
143-
extensions || (originalError && (originalError: any).extensions);
142+
const _extensions = extensions || (originalError && originalError.extensions);
144143

145144
Object.defineProperties(this, {
146145
message: {

src/jsutils/instanceOf.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ declare function instanceOf(
2020
// See: https://webpack.js.org/guides/production/
2121
export default (process.env.NODE_ENV === 'production'
2222
? // eslint-disable-next-line no-shadow
23-
function instanceOf(value: any, constructor: any) {
23+
function instanceOf(value: mixed, constructor: mixed) {
2424
return value instanceof constructor;
2525
}
2626
: // eslint-disable-next-line no-shadow

src/type/definition.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function isType(type: mixed): boolean %checks {
7070

7171
export function assertType(type: mixed): GraphQLType {
7272
invariant(isType(type), `Expected ${inspect(type)} to be a GraphQL type.`);
73-
return (type: any);
73+
return type;
7474
}
7575

7676
/**
@@ -343,7 +343,7 @@ declare class GraphQLList<+T: GraphQLType> {
343343
+ofType: T;
344344
static <T>(ofType: T): GraphQLList<T>;
345345
// Note: constructors cannot be used for covariant types. Drop the "new".
346-
constructor(ofType: any): void;
346+
constructor(ofType: GraphQLType): void;
347347
}
348348
// eslint-disable-next-line no-redeclare
349349
export function GraphQLList(ofType) {
@@ -384,7 +384,7 @@ declare class GraphQLNonNull<+T: GraphQLNullableType> {
384384
+ofType: T;
385385
static <T>(ofType: T): GraphQLNonNull<T>;
386386
// Note: constructors cannot be used for covariant types. Drop the "new".
387-
constructor(ofType: any): void;
387+
constructor(ofType: GraphQLType): void;
388388
}
389389
// eslint-disable-next-line no-redeclare
390390
export function GraphQLNonNull(ofType) {
@@ -1076,7 +1076,7 @@ export class GraphQLEnumType /* <T> */ {
10761076
return this._nameLookup[name];
10771077
}
10781078
1079-
serialize(value: any /* T */): ?string {
1079+
serialize(value: mixed /* T */): ?string {
10801080
const enumValue = this._valueLookup.get(value);
10811081
if (enumValue) {
10821082
return enumValue.name;
@@ -1226,7 +1226,7 @@ defineToJSON(GraphQLInputObjectType);
12261226
function defineInputFieldMap(
12271227
config: GraphQLInputObjectTypeConfig,
12281228
): GraphQLInputFieldMap {
1229-
const fieldMap: any = resolveThunk(config.fields) || {};
1229+
const fieldMap = resolveThunk(config.fields) || {};
12301230
invariant(
12311231
isPlainObj(fieldMap),
12321232
`${config.name} fields must be an object with field names as keys or a ` +

src/utilities/TypeInfo.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ export class TypeInfo {
139139
return this._enumValue;
140140
}
141141

142-
// Flow does not yet handle this case.
143-
enter(node: any /* ASTNode */) {
142+
enter(node: ASTNode) {
144143
const schema = this._schema;
145144
// Note: many of the types below are explicitly typed as "mixed" to drop
146145
// any assumptions of a valid schema to ensure runtime types are properly

0 commit comments

Comments
 (0)