3 This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions.
\r
5 This library is primarily used by the `--importHelpers` flag in TypeScript.
\r
6 When using `--importHelpers`, a module that uses helper functions like `__extends` and `__assign` in the following emitted file:
\r
9 var __assign = (this && this.__assign) || Object.assign || function(t) {
\r
10 for (var s, i = 1, n = arguments.length; i < n; i++) {
\r
12 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
\r
18 exports.y = __assign({}, exports.x);
\r
22 will instead be emitted as something like the following:
\r
25 var tslib_1 = require("tslib");
\r
27 exports.y = tslib_1.__assign({}, exports.x);
\r
30 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.
\r
31 For optimized bundles with TypeScript, you should absolutely consider using `tslib` and `--importHelpers`.
\r
35 For the latest stable version, run:
\r
40 # TypeScript 2.3.3 or later
\r
43 # TypeScript 2.3.2 or earlier
\r
44 npm install tslib@1.6.1
\r
50 # TypeScript 2.3.3 or later
\r
53 # TypeScript 2.3.2 or earlier
\r
54 yarn add tslib@1.6.1
\r
60 # TypeScript 2.3.3 or later
\r
63 # TypeScript 2.3.2 or earlier
\r
64 bower install tslib@1.6.1
\r
70 # TypeScript 2.3.3 or later
\r
73 # TypeScript 2.3.2 or earlier
\r
74 jspm install tslib@1.6.1
\r
79 Set the `importHelpers` compiler option on the command line:
\r
82 tsc --importHelpers file.ts
\r
85 or in your tsconfig.json:
\r
89 "compilerOptions": {
\r
90 "importHelpers": true
\r
95 #### For bower and JSPM users
\r
97 You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:
\r
101 "compilerOptions": {
\r
103 "importHelpers": true,
\r
106 "tslib" : ["bower_components/tslib/tslib.d.ts"]
\r
116 "compilerOptions": {
\r
117 "module": "system",
\r
118 "importHelpers": true,
\r
121 "tslib" : ["jspm_packages/npm/tslib@1.[version].0/tslib.d.ts"]
\r
130 There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.
\r
132 * [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.
\r
133 * Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).
\r
134 * Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).
\r
135 * Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.
\r
136 * [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
\r
140 * [Quick tutorial](http://www.typescriptlang.org/Tutorial)
\r
141 * [Programming handbook](http://www.typescriptlang.org/Handbook)
\r
142 * [Homepage](http://www.typescriptlang.org/)
\r