diff --git a/src/__fixtures__/index.js b/src/__fixtures__/index.js index ff912f40a5..460bee30f0 100644 --- a/src/__fixtures__/index.js +++ b/src/__fixtures__/index.js @@ -3,14 +3,16 @@ import { join } from 'path'; import { readFileSync } from 'fs'; -function readLocalFile(filename) { +function readLocalFile(filename: string): string { return readFileSync(join(__dirname, filename), 'utf8'); } -export const bigSchemaSDL = readLocalFile('github-schema.graphql'); -export const bigSchemaIntrospectionResult = JSON.parse( +export const bigSchemaSDL: string = readLocalFile('github-schema.graphql'); +export const bigSchemaIntrospectionResult: any = JSON.parse( readLocalFile('github-schema.json'), ); -export const kitchenSinkSDL = readLocalFile('schema-kitchen-sink.graphql'); -export const kitchenSinkQuery = readLocalFile('kitchen-sink.graphql'); +export const kitchenSinkSDL: string = readLocalFile( + 'schema-kitchen-sink.graphql', +); +export const kitchenSinkQuery: string = readLocalFile('kitchen-sink.graphql'); diff --git a/src/__tests__/starWarsSchema.js b/src/__tests__/starWarsSchema.js index 37fe0ada36..adac1a5ce2 100644 --- a/src/__tests__/starWarsSchema.js +++ b/src/__tests__/starWarsSchema.js @@ -293,7 +293,7 @@ const queryType = new GraphQLObjectType({ * Finally, we construct our schema (whose starting query type is the query * type we defined above) and export it. */ -export const StarWarsSchema = new GraphQLSchema({ +export const StarWarsSchema: GraphQLSchema = new GraphQLSchema({ query: queryType, types: [humanType, droidType], }); diff --git a/src/jsutils/Path.js b/src/jsutils/Path.js index 17f78e6c77..f477354e07 100644 --- a/src/jsutils/Path.js +++ b/src/jsutils/Path.js @@ -8,7 +8,10 @@ export type Path = {| /** * Given a Path and a key, return a new Path containing the new key. */ -export function addPath(prev: $ReadOnly | void, key: string | number) { +export function addPath( + prev: $ReadOnly | void, + key: string | number, +): Path { return { prev, key }; } diff --git a/src/language/lexer.js b/src/language/lexer.js index a9601bdfb5..58e3a0d419 100644 --- a/src/language/lexer.js +++ b/src/language/lexer.js @@ -76,7 +76,7 @@ export class Lexer { /** * @internal */ -export function isPunctuatorTokenKind(kind: TokenKindEnum) { +export function isPunctuatorTokenKind(kind: TokenKindEnum): boolean %checks { return ( kind === TokenKind.BANG || kind === TokenKind.DOLLAR || diff --git a/src/language/visitor.js b/src/language/visitor.js index ef3d533fee..68985d9c12 100644 --- a/src/language/visitor.js +++ b/src/language/visitor.js @@ -48,7 +48,7 @@ export type VisitorKeyMap = $ObjMap< (T) => $ReadOnlyArray<$Keys>, >; -export const QueryDocumentKeys = { +export const QueryDocumentKeys: VisitorKeyMap = { Name: [], Document: ['definitions'], @@ -135,7 +135,7 @@ export const QueryDocumentKeys = { InputObjectTypeExtension: ['name', 'directives', 'fields'], }; -export const BREAK = Object.freeze({}); +export const BREAK: { ... } = Object.freeze({}); /** * visit() will walk through an AST using a depth first traversal, calling @@ -363,7 +363,7 @@ export function visitInParallel( return { enter(node) { for (let i = 0; i < visitors.length; i++) { - if (!skipping[i]) { + if (skipping[i] == null) { const fn = getVisitFn(visitors[i], node.kind, /* isLeaving */ false); if (fn) { const result = fn.apply(visitors[i], arguments); @@ -380,7 +380,7 @@ export function visitInParallel( }, leave(node) { for (let i = 0; i < visitors.length; i++) { - if (!skipping[i]) { + if (skipping[i] == null) { const fn = getVisitFn(visitors[i], node.kind, /* isLeaving */ true); if (fn) { const result = fn.apply(visitors[i], arguments);