JSPM

  • Created
  • Published
  • Downloads 3702
  • Score
    100M100P100Q134051F
  • License MIT

Augment the TypeScript compiler module's types to expose hidden internal types

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ts-expose-internals) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    License

    TypeScript Internal Types

    Expose TypeScript internal types by simply adding a development dependency.

    Setup

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

      {
        "devDependencies": {
          "typescript": "^3.9.6",
          "ts-expose-internals": "^3.9.6"
        }
      }
    2. Run npm install / yarn install

    3. Add the following line to your main index.ts

      import {} from 'ts-expose-internals'

      Notes:

      • This line only needs to be added to one source file (it doesn't have to be main index), and the types will be recognized project-wide
      • We include the empty {} from in order to make sure it does not get output in compiled source
      • You might need to tell your linter to ignore the import line if it's set to flag empty imports

    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

    This repository is deployed on a server which runs scripts/cron.sh every 12 hours.

    The scripts compare our release tags with the TypeScript compiler's tags. If new versions are detected, it builds the compiler source, with internal types included, and publishes a new release with its types.

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

    Notes

    • We publish for TS releases only. If you'd like nightly builds, have a look at byots.
    • If we don't have a package for the latest release, please allow 24hrs, then file an issue.

    Acknowledgments

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