UNPKG

566 BTypeScriptView Raw
1import type { NodePath } from '@babel/traverse';
2type Predicate<T extends NodePath> = (path: NodePath) => path is T;
3/**
4 * This can be used in two ways
5 * 1. Find the first return path that passes the predicate function
6 * (for example to check if a function is returning something)
7 * 2. Find all occurrences of return values
8 * For this the predicate acts more like a collector and always needs to return false
9 */
10export default function findFunctionReturn<T extends NodePath = NodePath>(path: NodePath, predicate: Predicate<T>): T | undefined;
11export {};