Skip to content

Commit a9b38d7

Browse files
committed
Flow: add missing typings on exports
1 parent 7c3cf9c commit a9b38d7

File tree

5 files changed

+17
-12
lines changed

5 files changed

+17
-12
lines changed

src/__fixtures__/index.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
import { join } from 'path';
44
import { readFileSync } from 'fs';
55

6-
function readLocalFile(filename) {
6+
function readLocalFile(filename: string): string {
77
return readFileSync(join(__dirname, filename), 'utf8');
88
}
99

10-
export const bigSchemaSDL = readLocalFile('github-schema.graphql');
11-
export const bigSchemaIntrospectionResult = JSON.parse(
10+
export const bigSchemaSDL: string = readLocalFile('github-schema.graphql');
11+
export const bigSchemaIntrospectionResult: any = JSON.parse(
1212
readLocalFile('github-schema.json'),
1313
);
1414

15-
export const kitchenSinkSDL = readLocalFile('schema-kitchen-sink.graphql');
16-
export const kitchenSinkQuery = readLocalFile('kitchen-sink.graphql');
15+
export const kitchenSinkSDL: string = readLocalFile(
16+
'schema-kitchen-sink.graphql',
17+
);
18+
export const kitchenSinkQuery: string = readLocalFile('kitchen-sink.graphql');

src/__tests__/starWarsSchema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ const queryType = new GraphQLObjectType({
293293
* Finally, we construct our schema (whose starting query type is the query
294294
* type we defined above) and export it.
295295
*/
296-
export const StarWarsSchema = new GraphQLSchema({
296+
export const StarWarsSchema: GraphQLSchema = new GraphQLSchema({
297297
query: queryType,
298298
types: [humanType, droidType],
299299
});

src/jsutils/Path.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export type Path = {|
88
/**
99
* Given a Path and a key, return a new Path containing the new key.
1010
*/
11-
export function addPath(prev: $ReadOnly<Path> | void, key: string | number) {
11+
export function addPath(
12+
prev: $ReadOnly<Path> | void,
13+
key: string | number,
14+
): Path {
1215
return { prev, key };
1316
}
1417

src/language/lexer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class Lexer {
7676
/**
7777
* @internal
7878
*/
79-
export function isPunctuatorTokenKind(kind: TokenKindEnum) {
79+
export function isPunctuatorTokenKind(kind: TokenKindEnum): boolean %checks {
8080
return (
8181
kind === TokenKind.BANG ||
8282
kind === TokenKind.DOLLAR ||

src/language/visitor.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export type VisitorKeyMap<KindToNode> = $ObjMap<
4848
<T>(T) => $ReadOnlyArray<$Keys<T>>,
4949
>;
5050

51-
export const QueryDocumentKeys = {
51+
export const QueryDocumentKeys: VisitorKeyMap<ASTKindToNode> = {
5252
Name: [],
5353

5454
Document: ['definitions'],
@@ -135,7 +135,7 @@ export const QueryDocumentKeys = {
135135
InputObjectTypeExtension: ['name', 'directives', 'fields'],
136136
};
137137

138-
export const BREAK = Object.freeze({});
138+
export const BREAK: { ... } = Object.freeze({});
139139

140140
/**
141141
* visit() will walk through an AST using a depth first traversal, calling
@@ -363,7 +363,7 @@ export function visitInParallel(
363363
return {
364364
enter(node) {
365365
for (let i = 0; i < visitors.length; i++) {
366-
if (!skipping[i]) {
366+
if (skipping[i] == null) {
367367
const fn = getVisitFn(visitors[i], node.kind, /* isLeaving */ false);
368368
if (fn) {
369369
const result = fn.apply(visitors[i], arguments);
@@ -380,7 +380,7 @@ export function visitInParallel(
380380
},
381381
leave(node) {
382382
for (let i = 0; i < visitors.length; i++) {
383-
if (!skipping[i]) {
383+
if (skipping[i] == null) {
384384
const fn = getVisitFn(visitors[i], node.kind, /* isLeaving */ true);
385385
if (fn) {
386386
const result = fn.apply(visitors[i], arguments);

0 commit comments

Comments
 (0)