Skip to content

Remove some unneeded 'any' #1448

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

Merged
merged 1 commit into from
Aug 5, 2018
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 */) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flow now support this case 🎉

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