ts-expose-internals

raw JSON →
5.6.3 verified Fri May 01 auth: no javascript

Expose TypeScript compiler's hidden @internal types via module augmentation. Current stable version is 5.6.3, released to match TypeScript 5.6.3. Published automatically within 24 hours of each full TypeScript release. Key differentiator: unlike byots (which requires a fork of TypeScript), this package works by augmenting the official 'typescript' module, so you can access internal types like JsDoc, Symbol, etc. directly from 'typescript'. It does not modify runtime behavior, only types. Installation requires an aliased devDependency under @types/ts-expose-internals to ensure global type adoption. Supports ESM and CJS as it simply provides type augmentation.

error Cannot find module 'ts-expose-internals' or its corresponding type declarations.
cause Package installed directly as 'ts-expose-internals' instead of aliased under '@types/ts-expose-internals'.
fix
Remove the direct 'ts-expose-internals' install and add '@types/ts-expose-internals': 'npm:ts-expose-internals@<version>' to devDependencies.
error Module augmentation error: 'typescript' has no exported member 'JsDoc'.
cause Mismatched versions: '@types/ts-expose-internals' version does not match installed typescript version.
fix
Update both to the same version and reinstall.
error Type 'typeof import('/path/to/typescript')' has no property 'JsDoc'.
cause The augmentation file is not being picked up. Possibly missing aliased install or tsconfig does not include node_modules/@types.
fix
Ensure '@types' is in 'types' or 'typeRoots' in tsconfig.json, and that the aliased dependency is correctly added.
breaking Must use exact same version as your typescript dependency. Mismatch causes type errors.
fix Ensure '@types/ts-expose-internals' version matches your 'typescript' version exactly.
gotcha Types only exposed for full releases, not nightly/RC. Use byots for nightly builds.
fix Use byots if you need nightly internal types.
gotcha Package must be installed as an aliased devDependency under '@types/ts-expose-internals'. Installing directly as 'ts-expose-internals' does not work.
fix Use: npm install --save-dev @types/ts-expose-internals@npm:ts-expose-internals@5.6.3
deprecated As of TypeScript 5.0+, some internal types may have changed or been removed. Not all internal APIs are stable.
fix Check TypeScript changelog for internal API changes. This package only regenerates types per release.
npm install ts-expose-internals
yarn add ts-expose-internals
pnpm add ts-expose-internals

Demonstrates installation via aliased dependency and usage of internal type JsDoc from 'typescript'.

// 1. Add to package.json:
// {
//   "devDependencies": {
//     "typescript": "^5.6.3",
//     "@types/ts-expose-internals": "npm:ts-expose-internals@5.6.3"
//   }
// }
// 2. Run: npm install
// 3. Now internal types are available:
import { JsDoc, Symbol, Type } from 'typescript';

const doc: JsDoc = { comment: '/** example */', tags: [] };
console.log(doc);