tslib is a compact runtime library provided by Microsoft that contains all the essential helper functions emitted by the TypeScript compiler. It is primarily used in conjunction with the `--importHelpers` compiler option, which instructs TypeScript to import these common helper functions (such as `__extends`, `__assign`, `__decorate`, `__awaiter`) from `tslib` rather than embedding them directly in every compiled output file. This approach leads to significantly smaller JavaScript bundles and reduced runtime overhead by avoiding redundant function declarations. The current stable version is 2.8.1, with frequent patch and minor releases aligning with TypeScript's development. It differentiates itself by being the official, highly optimized runtime solution for TypeScript's emitted code, ensuring maximum compatibility and efficiency for projects compiled with TypeScript.
npm install tslibVerified import paths — ran on the pinned version, not inferred.
Configures TypeScript to automatically import helper functions from `tslib`, reducing code duplication and bundle size. Requires `npm install tslib`.
Check your `typescript` package version and install the compatible `tslib` version. For modern TypeScript (3.9.2+), `npm install tslib` typically installs the correct v2+.
Upgrade to `tslib@^2.5.1` or later to ensure proper module resolution with modern TypeScript compiler settings and bundlers.
Upgrade `tslib` to version 2.6.0 or higher to correctly support the runtime helpers for `using` and `await using` syntax emitted by the TypeScript compiler.
Upgrade to `tslib@^2.8.1` to ensure `__importStar` accurately reflects the properties of imported modules, including non-enumerable ones.
Rely on standard `package.json` `exports` or `module` fields for ES module resolution. Modern bundlers and TypeScript's `moduleResolution` settings should automatically resolve the correct entry point without direct path references.
Run `npm install tslib` or `yarn add tslib`. Verify that `moduleResolution` in your `tsconfig.json` is correctly configured for your project (e.g., `node`, `node16`, `bundler`).
Ensure `tslib` is installed (`npm install tslib`) and that your build pipeline (e.g., webpack, Rollup, esbuild) is configured to include and correctly bundle `tslib`'s runtime helpers.
Confirm `tslib` is a project dependency, is correctly installed, and that your module loader/bundler is successfully making the `tslib` helpers available at runtime. Ensure `tsconfig.json`'s `target` and `module` options are compatible with your runtime and `tslib` version.
No dependency data recorded yet.