# Is ts-api-utils ESM-only? Can you require() it?

> ts-api-utils@2.5.0 declares CommonJS and ESM builds, but require() fails at runtime. Dual package on paper — require() failed in our runtime test.

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

Last verified Sep 9, 2026 against ts-api-utils@2.5.0.

ts-api-utils declares both a CommonJS entry and a native ESM entry (ESM added in 0.0.18), but require("ts-api-utils") failed on every Node.js version in our probe: TypeError: Cannot read properties of undefined (reading 'Intrinsic'). That usually means a missing peer dependency, a browser-only global, or a package that refuses to be loaded with require(); see the runtime table below.

## What to do

1. require("ts-api-utils") failed in our probe on every Node.js version (TypeError: Cannot read properties of undefined (reading 'Intrinsic')); check the package README for peer dependencies or setup before relying on it.
2. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 2.5.0 (Mar 19, 2026)
- Module format: Dual (CommonJS + ESM)
- Last CommonJS version: 2.5.0
- Native ESM since: 0.0.18
- TypeScript types: bundled
- Node engines: >=18.12
- Weekly downloads: 112.7M
- License: MIT

## Runtime test results for ts-api-utils@2.5.0

Installed and executed on Sep 9, 2026 with require("ts-api-utils") from a CommonJS file and import "ts-api-utils" from an ES module.

| Runtime | require("ts-api-utils") | import "ts-api-utils" |
|---|---|---|
| Node.js 18 | fails (TypeError) | fails (TypeError) |
| Node.js 20 | fails (TypeError) | fails (TypeError) |
| Node.js 22 | fails (TypeError) | fails (TypeError) |
| Node.js 24 | fails (TypeError) | fails (TypeError) |
| Node.js 26 | fails (TypeError) | fails (TypeError) |
| Bun 1.4.0 | fails (TypeError) | fails (TypeError) |

## How to import ts-api-utils

ES modules:

```js
import * as tsApiUtils from "ts-api-utils";
```

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS:

```js
// require("ts-api-utils") failed in our probe on every Node.js version we test (TypeError: Cannot read properties of undefined (reading 'Intrinsic')); see the runtime table.
const tsApiUtils = require("ts-api-utils");
```

## Module format by version

Derived from the type, main and exports fields of every stable release on npm (50 versions; the newest 50 shown).

| Versions | Format | First published |
|---|---|---|
| 0.0.18 – 2.5.0 | Dual (CommonJS + ESM) | Feb 7, 2023 |

## Frequently asked

**Is ts-api-utils ESM-only?**

ts-api-utils@2.5.0 declares CommonJS and ESM builds, but require() fails at runtime. ts-api-utils declares both a CommonJS entry and a native ESM entry (ESM added in 0.0.18), but require("ts-api-utils") failed on every Node.js version in our probe: TypeError: Cannot read properties of undefined (reading 'Intrinsic'). That usually means a missing peer dependency, a browser-only global, or a package that refuses to be loaded with require(); see the runtime table below.

**Can I require ts-api-utils?**

Not in practice. ts-api-utils declares a CommonJS entry, but require("ts-api-utils") failed on every Node.js version in our probe: TypeError: Cannot read properties of undefined (reading 'Intrinsic'). Check the package README for peer dependencies or setup before relying on it.

**Does ts-api-utils work in Bun?**

Importing ts-api-utils failed in Bun 1.4.0 on Sep 9, 2026: TypeError: undefined is not an object (evaluating 'ts9.TypeFlags.Intrinsic')

**Does ts-api-utils ship TypeScript types?**

Yes. ts-api-utils bundles its own type declarations; no @types package is needed.

## Links

- [ts-api-utils on npm](https://www.npmjs.com/package/ts-api-utils)
- [Source repository](https://github.com/JoshuaKGoldberg/ts-api-utils)
- [HTML version](https://canirequire.com/package/ts-api-utils/)
- [JSON version](https://canirequire.com/package/ts-api-utils.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
