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.Node
s and/or ts.Type
s, this package is your friend. 💗
npm i ts-api-utils
yarn add ts-api-utils
pnpm add ts-api-utils
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.