Reduce the number of $FlowFixMe
parent
eb5eda9276
commit
6085e92e45
File diff suppressed because it is too large
Load Diff
|
@ -97,7 +97,6 @@ export default class Collector {
|
|||
}
|
||||
|
||||
_freestyle(group: Group, root: Node, scope: Scope, params: InstanceParam[]) {
|
||||
// $FlowFixMe
|
||||
const iter = traverse(root);
|
||||
let result = iter.next();
|
||||
|
||||
|
@ -116,7 +115,6 @@ export default class Collector {
|
|||
}
|
||||
|
||||
* _collect(group: Group, node: Node, scope: Scope, params: InstanceParam[]): Task {
|
||||
// $FlowFixMe
|
||||
const extractor = group[node.type];
|
||||
|
||||
if (!extractor) {
|
||||
|
@ -325,7 +323,6 @@ function pathToNamespace(path: string): string {
|
|||
}
|
||||
|
||||
function isAcceptableGroup(group: Group, node: Node): boolean {
|
||||
// $FlowFixMe
|
||||
return group.entries.includes(node.type);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import type {Node} from '@babel/types';
|
|||
import {VISITOR_KEYS} from '@babel/types';
|
||||
|
||||
// Given the AST output of babylon parse, walk through in a depth-first order.
|
||||
export default function* traverse(node: Node & {type: string}): Generator<Node, void, boolean> {
|
||||
export default function* traverse(node: Node): Generator<Node, void, boolean> {
|
||||
const keys = VISITOR_KEYS[node.type];
|
||||
|
||||
if (!keys) {
|
||||
|
|
|
@ -12,8 +12,8 @@ export function partition<T>(iter: Iterable<T>, predicate: T => boolean): [T[],
|
|||
}
|
||||
|
||||
// TODO: avoid it?
|
||||
export function isNode(it: any): boolean %checks {
|
||||
return it && typeof it === 'object' && it.type;
|
||||
export function isNode(it: mixed): boolean %checks {
|
||||
return it != null && typeof it === 'object' && it.type != null;
|
||||
}
|
||||
|
||||
// I so much dream about the user guards...
|
||||
|
|
Loading…
Reference in New Issue