Home

Awesome

License

TypeScript Internal Types

Expose TypeScript internal types by simply adding a development dependency.

Setup

  1. Add aliased dependency to package.json (use the same version as your typescript version)

    {
      "devDependencies": {
        "typescript": "^5.1.3",
        // Note: The package is 'ts-expose-internals', but we are aliasing within the @types scope to make TS adopt it globally
        "@types/ts-expose-internals": "npm:ts-expose-internals@5.1.3"
      }
    }
    
  2. Run npm install / yarn install

Usage

All internal types are now available within the primary typescript module

// This namespace is flagged @internal and is omitted from published types, but now we can access it!
import { JsDoc } from 'typescript'

How It Works

The code within this repo runs on a schedule of once per day via GitHub Actions.

It checks for new TypeScript release tags, and if there are any, it clones the source code for that release and builds the internal types. After, it performs a bit of transformation magic and publishes the package to NPM.

New types are added to the 'typescript' module via the Module Augmentation technique.

Notes

Acknowledgments

Thanks to basarat for his work on byots, which served as the inspiration!