$ cnpm install babel-type-scopes
Utils for looking up and working with Flow & TypeScript scopes in Babel
import {
isTypeScope,
getClosestTypeScopePath,
getOwnTypeBindings,
getTypeBinding,
} from 'babel-type-scopes';
isTypeScope(path); // true | false
getClosestTypeScopePath(path); // (Path)
getOwnTypeBindings(path) // { foo: { kind, path, id }, bar: { kind, path, id } }
getTypeBinding(path, 'foo') // { kind, path, id }
yarn add babel-type-scopes
isTypeScope(path: Path) => booleanCheck if a path creates a type scope.
getClosestTypeScope(path: Path) => PathFind the closest path to a type scope.
getOwnTypeBindings(path: Path) => BindingsFind the closest path to a type scope.
getTypeBinding(path: Path) => BindingSearch for a binding in the current scope and parent scopes.
Bindingtype Binding = {
kind: 'import' | 'declaration' | 'expression' | 'param',
path: Path,
id: Path,
};
Bindingstype Bindings = { [name: string]: Binding };
Copyright 2013 - present © cnpmjs.org | Home |