Skip to content

Commit

Permalink
Remove some unneeded 'any' (#1448)
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov authored Aug 5, 2018
1 parent 9f7faaa commit c3292db
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
5 changes: 2 additions & 3 deletions src/error/GraphQLError.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function GraphQLError( // eslint-disable-line no-redeclare
source?: ?Source,
positions?: ?$ReadOnlyArray<number>,
path?: ?$ReadOnlyArray<string | number>,
originalError?: ?Error,
originalError?: ?Error & { +extensions: mixed },
extensions?: ?{ [key: string]: mixed },
) {
// Compute list of blame nodes.
Expand Down Expand Up @@ -139,8 +139,7 @@ export function GraphQLError( // eslint-disable-line no-redeclare
}, []);
}

const _extensions =
extensions || (originalError && (originalError: any).extensions);
const _extensions = extensions || (originalError && originalError.extensions);

Object.defineProperties(this, {
message: {
Expand Down
2 changes: 1 addition & 1 deletion src/jsutils/instanceOf.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ declare function instanceOf(
// See: https://webpack.js.org/guides/production/
export default (process.env.NODE_ENV === 'production'
? // eslint-disable-next-line no-shadow
function instanceOf(value: any, constructor: any) {
function instanceOf(value: mixed, constructor: mixed) {
return value instanceof constructor;
}
: // eslint-disable-next-line no-shadow
Expand Down
10 changes: 5 additions & 5 deletions src/type/definition.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export function isType(type: mixed): boolean %checks {

export function assertType(type: mixed): GraphQLType {
invariant(isType(type), `Expected ${inspect(type)} to be a GraphQL type.`);
return (type: any);
return type;
}

/**
Expand Down Expand Up @@ -343,7 +343,7 @@ declare class GraphQLList<+T: GraphQLType> {
+ofType: T;
static <T>(ofType: T): GraphQLList<T>;
// Note: constructors cannot be used for covariant types. Drop the "new".
constructor(ofType: any): void;
constructor(ofType: GraphQLType): void;
}
// eslint-disable-next-line no-redeclare
export function GraphQLList(ofType) {
Expand Down Expand Up @@ -384,7 +384,7 @@ declare class GraphQLNonNull<+T: GraphQLNullableType> {
+ofType: T;
static <T>(ofType: T): GraphQLNonNull<T>;
// Note: constructors cannot be used for covariant types. Drop the "new".
constructor(ofType: any): void;
constructor(ofType: GraphQLType): void;
}
// eslint-disable-next-line no-redeclare
export function GraphQLNonNull(ofType) {
Expand Down Expand Up @@ -1076,7 +1076,7 @@ export class GraphQLEnumType /* <T> */ {
return this._nameLookup[name];
}
serialize(value: any /* T */): ?string {
serialize(value: mixed /* T */): ?string {
const enumValue = this._valueLookup.get(value);
if (enumValue) {
return enumValue.name;
Expand Down Expand Up @@ -1226,7 +1226,7 @@ defineToJSON(GraphQLInputObjectType);
function defineInputFieldMap(
config: GraphQLInputObjectTypeConfig,
): GraphQLInputFieldMap {
const fieldMap: any = resolveThunk(config.fields) || {};
const fieldMap = resolveThunk(config.fields) || {};
invariant(
isPlainObj(fieldMap),
`${config.name} fields must be an object with field names as keys or a ` +
Expand Down
3 changes: 1 addition & 2 deletions src/utilities/TypeInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ export class TypeInfo {
return this._enumValue;
}

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

0 comments on commit c3292db

Please sign in to comment.