ts-api-utils - v1.4.0

Utility functions for working with TypeScript's API. Successor to the wonderful tsutils.

ts-api-utils exports functions and types for working with TypeScript's node and type APIs. If you're working with ts.Nodes and/or ts.Types, this package is your friend. 💗

Installation

npm i ts-api-utils
yarn add ts-api-utils
pnpm add ts-api-utils

Usage

import * as tsutils from "ts-api-utils";

The most commonly used functions are type predicates not yet available on TypeScript. For example:

declare const node: ts.Node;

if (isAbstractKeyword(node)) {
// ...
}

See the sidebar for the full list of available functions and types.

Tip: if a function you'd want to use appears to be missing, check whether it exists on TypeScript itself.