Gathering detailed insights and metrics for tslib
Gathering detailed insights and metrics for tslib
Gathering detailed insights and metrics for tslib
Gathering detailed insights and metrics for tslib
npm install tslib
Typescript
Module System
Node Version
NPM Version
TypeScript (74.77%)
JavaScript (25.14%)
HTML (0.1%)
Total Downloads
40,353,608,609
Last Day
12,611,651
Last Week
248,847,156
Last Month
1,084,131,899
Last Year
12,420,853,478
0BSD License
1,309 Stars
312 Commits
137 Forks
73 Watchers
29 Branches
48 Contributors
Updated on Jul 06, 2025
Minified
Minified + Gzipped
Latest Version
2.8.1
Package Id
tslib@2.8.1
Unpacked Size
88.24 kB
Size
18.04 kB
File Count
14
NPM Version
10.9.0
Node Version
22.10.0
Published on
Oct 31, 2024
Cumulative downloads
Total Downloads
No dependencies detected.
This is a runtime library for TypeScript that contains all of the TypeScript helper functions.
This library is primarily used by the --importHelpers
flag in TypeScript.
When using --importHelpers
, a module that uses helper functions like __extends
and __assign
in the following emitted file:
1var __assign = (this && this.__assign) || Object.assign || function(t) { 2 for (var s, i = 1, n = arguments.length; i < n; i++) { 3 s = arguments[i]; 4 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 5 t[p] = s[p]; 6 } 7 return t; 8}; 9exports.x = {}; 10exports.y = __assign({}, exports.x); 11
will instead be emitted as something like the following:
1var tslib_1 = require("tslib"); 2exports.x = {}; 3exports.y = tslib_1.__assign({}, exports.x);
Because this can avoid duplicate declarations of things like __extends
, __assign
, etc., this means delivering users smaller files on average, as well as less runtime overhead.
For optimized bundles with TypeScript, you should absolutely consider using tslib
and --importHelpers
.
For the latest stable version, run:
1# TypeScript 3.9.2 or later 2npm install tslib 3 4# TypeScript 3.8.4 or earlier 5npm install tslib@^1 6 7# TypeScript 2.3.2 or earlier 8npm install tslib@1.6.1
1# TypeScript 3.9.2 or later 2yarn add tslib 3 4# TypeScript 3.8.4 or earlier 5yarn add tslib@^1 6 7# TypeScript 2.3.2 or earlier 8yarn add tslib@1.6.1
1# TypeScript 3.9.2 or later 2bower install tslib 3 4# TypeScript 3.8.4 or earlier 5bower install tslib@^1 6 7# TypeScript 2.3.2 or earlier 8bower install tslib@1.6.1
1# TypeScript 3.9.2 or later 2jspm install tslib 3 4# TypeScript 3.8.4 or earlier 5jspm install tslib@^1 6 7# TypeScript 2.3.2 or earlier 8jspm install tslib@1.6.1
Set the importHelpers
compiler option on the command line:
tsc --importHelpers file.ts
or in your tsconfig.json:
1{ 2 "compilerOptions": { 3 "importHelpers": true 4 } 5}
You will need to add a paths
mapping for tslib
, e.g. For Bower users:
1{ 2 "compilerOptions": { 3 "module": "amd", 4 "importHelpers": true, 5 "baseUrl": "./", 6 "paths": { 7 "tslib" : ["bower_components/tslib/tslib.d.ts"] 8 } 9 } 10}
For JSPM users:
1{ 2 "compilerOptions": { 3 "module": "system", 4 "importHelpers": true, 5 "baseUrl": "./", 6 "paths": { 7 "tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"] 8 } 9 } 10}
package.json
and bower.json
git tag [version]
git push --tags
Done.
There are many ways to contribute to TypeScript.
No vulnerabilities found.
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
project is fuzzed
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 9
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
Found 9/14 approved changesets -- score normalized to 6
Reason
branch protection is not maximal on development and all release branches
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
-4.9%
12,611,651
Compared to previous day
Last Week
-8.1%
248,847,156
Compared to previous week
Last Month
1%
1,084,131,899
Compared to previous month
Last Year
1.5%
12,420,853,478
Compared to previous year