canirequire

canirequire โ€บ Dual (CommonJS + ESM) โ€บ ts-api-utils

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

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. Markdown ยท JSON

Dual (CommonJS + ESM) Dual package on paper โ€” require() failed in our runtime test

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.
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

Does ts-api-utils@2.5.0 actually load? Runtime test results

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.

Runtimerequire("ts-api-utils")import "ts-api-utils"
Node.js 18โœ— failsTypeErrorโœ— failsTypeError
Node.js 20โœ— failsTypeErrorโœ— failsTypeError
Node.js 22โœ— failsTypeErrorโœ— failsTypeError
Node.js 24โœ— failsTypeErrorโœ— failsTypeError
Node.js 26โœ— failsTypeErrorโœ— failsTypeError
Bun 1.4.0โœ— failsTypeErrorโœ— failsTypeError

A failing require() on a CommonJS package usually means the package needs a browser/DOM global, a peer dependency, or a native binary that is not available in a bare Node.js process.

How to import ts-api-utils

ES modules (import)

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 (require)

// 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, corrected where a runtime test of that version contradicted them (50 versions; the newest 50 shown).

VersionsFormatFirst published
0.0.18 โ€“ 2.5.0Dual (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

Other dual (commonjs + esm) packages

Similar popularity