add some more flow types

This commit is contained in:
Henry Zhu
2015-12-18 01:19:06 -05:00
parent effaf820c3
commit c2d7e95e1a
19 changed files with 75 additions and 45 deletions

View File

@@ -1,3 +1,5 @@
/* @noflow */
import isPlainObject from "lodash/lang/isPlainObject";
import isNumber from "lodash/lang/isNumber";
import isRegExp from "lodash/lang/isRegExp";
@@ -218,7 +220,7 @@ export function toExpression(node: Object): Object {
}
}
export function toBlock(node, parent: Object): Object {
export function toBlock(node: Object, parent: Object): Object {
if (t.isBlockStatement(node)) {
return node;
}

View File

@@ -1,3 +1,5 @@
/* @flow */
import * as t from "./index";
/**
@@ -19,7 +21,7 @@ export function createUnionTypeAnnotation(types: Array<Object>) {
* Dedupe type annotations.
*/
export function removeTypeDuplicates(nodes: Array<Object>) {
export function removeTypeDuplicates(nodes: Array<Object>): Array<Object> {
let generics = {};
let bases = {};

View File

@@ -1,4 +1,4 @@
/* @noflow */
/* @flow */
import toFastProperties from "to-fast-properties";
import compact from "lodash/array/compact";
@@ -406,6 +406,7 @@ export function inherits(child: Object, parent: Object): Object {
export function assertNode(node?) {
if (!isNode(node)) {
// $FlowFixMe
throw new TypeError("Not a valid node " + (node && node.type));
}
}

View File

@@ -1,3 +1,5 @@
/* @flow */
import { getBindingIdentifiers } from "./retrievers";
import esutils from "esutils";
import * as t from "./index";
@@ -67,7 +69,7 @@ export function isReferenced(node: Object, parent: Object): boolean {
case "ArrowFunctionExpression":
case "FunctionDeclaration":
case "FunctionExpression":
for (let param of (parent.params: Array)) {
for (let param of (parent.params: Array<any>)) {
if (param === node) return false;
}