Skip to content

Flow: add missing typings on exports #2337

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
Jan 6, 2020
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
12 changes: 7 additions & 5 deletions src/__fixtures__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
2 changes: 1 addition & 1 deletion src/__tests__/starWarsSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
});
5 changes: 4 additions & 1 deletion src/jsutils/Path.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<Path> | void, key: string | number) {
export function addPath(
prev: $ReadOnly<Path> | void,
key: string | number,
): Path {
return { prev, key };
}

Expand Down
2 changes: 1 addition & 1 deletion src/language/lexer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down
8 changes: 4 additions & 4 deletions src/language/visitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export type VisitorKeyMap<KindToNode> = $ObjMap<
<T>(T) => $ReadOnlyArray<$Keys<T>>,
>;

export const QueryDocumentKeys = {
export const QueryDocumentKeys: VisitorKeyMap<ASTKindToNode> = {
Name: [],

Document: ['definitions'],
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down