# babel-type-scopes

> Utils for looking up and working with Flow & TypeScript scopes in Babel

Latest version **1.1.0** (published 2018-06-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-type-scopes
pnpm add babel-type-scopes
yarn add babel-type-scopes
bun add babel-type-scopes
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-06-14 |
| First published | 2017-09-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 12 |
| Author | James Kyle |
| Maintainers | thejameskyle |
| Keywords | babel, utils, flow, typescript, scope, binding |

## Links

- npm: https://www.npmjs.com/package/babel-type-scopes
- Repository: https://github.com/babel-utils/babel-type-scopes
- Homepage: https://github.com/babel-utils/babel-type-scopes#readme
- Issues: https://github.com/babel-utils/babel-type-scopes/issues
- npm.io page: https://npm.io/package/babel-type-scopes

## Dependencies (1)

- [babel-flow-types](https://npm.io/package/babel-flow-types.md) ^1.2.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2018-06-14
- 1.0.0 — 2017-09-01

## README

# babel-type-scopes

> Utils for looking up and working with Flow & TypeScript scopes in Babel

```js
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 }
```

## Installation

```sh
yarn add babel-type-scopes
```

## API

#### `isTypeScope(path: Path) => boolean`

Check if a path creates a type scope.

#### `getClosestTypeScope(path: Path) => Path`

Find the closest path to a type scope.

#### `getOwnTypeBindings(path: Path) => Bindings`

Find the closest path to a type scope.

#### `getTypeBinding(path: Path) => Binding`

Search for a binding in the current scope and parent scopes.

### Types

#### `Binding`

```js
type Binding = {
  kind: 'import' | 'declaration' | 'expression' | 'param',
  path: Path,
  id: Path,
};
```

#### `Bindings`

```js
type Bindings = { [name: string]: Binding };
```

---
_Source: https://npm.io/package/babel-type-scopes · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
