Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / tslib / README.md
1 # tslib\r
2 \r
3 This is a runtime library for [TypeScript](http://www.typescriptlang.org/) that contains all of the TypeScript helper functions.\r
4 \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
7 \r
8 ```ts\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
11         s = arguments[i];\r
12         for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r
13             t[p] = s[p];\r
14     }\r
15     return t;\r
16 };\r
17 exports.x = {};\r
18 exports.y = __assign({}, exports.x);\r
19 \r
20 ```\r
21 \r
22 will instead be emitted as something like the following:\r
23 \r
24 ```ts\r
25 var tslib_1 = require("tslib");\r
26 exports.x = {};\r
27 exports.y = tslib_1.__assign({}, exports.x);\r
28 ```\r
29 \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
32 \r
33 # Installing\r
34 \r
35 For the latest stable version, run:\r
36 \r
37 ## npm\r
38 \r
39 ```sh\r
40 # TypeScript 2.3.3 or later\r
41 npm install tslib\r
42 \r
43 # TypeScript 2.3.2 or earlier\r
44 npm install tslib@1.6.1\r
45 ```\r
46 \r
47 ## yarn\r
48 \r
49 ```sh\r
50 # TypeScript 2.3.3 or later\r
51 yarn add tslib\r
52 \r
53 # TypeScript 2.3.2 or earlier\r
54 yarn add tslib@1.6.1\r
55 ```\r
56 \r
57 ## bower\r
58 \r
59 ```sh\r
60 # TypeScript 2.3.3 or later\r
61 bower install tslib\r
62 \r
63 # TypeScript 2.3.2 or earlier\r
64 bower install tslib@1.6.1\r
65 ```\r
66 \r
67 ## JSPM\r
68 \r
69 ```sh\r
70 # TypeScript 2.3.3 or later\r
71 jspm install tslib\r
72 \r
73 # TypeScript 2.3.2 or earlier\r
74 jspm install tslib@1.6.1\r
75 ```\r
76 \r
77 # Usage\r
78 \r
79 Set the `importHelpers` compiler option on the command line:\r
80 \r
81 ```\r
82 tsc --importHelpers file.ts\r
83 ```\r
84 \r
85 or in your tsconfig.json:\r
86 \r
87 ```json\r
88 {\r
89     "compilerOptions": {\r
90         "importHelpers": true\r
91     }\r
92 }\r
93 ```\r
94 \r
95 #### For bower and JSPM users\r
96 \r
97 You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:\r
98 \r
99 ```json\r
100 {\r
101     "compilerOptions": {\r
102         "module": "amd",\r
103         "importHelpers": true,\r
104         "baseUrl": "./",\r
105         "paths": {\r
106             "tslib" : ["bower_components/tslib/tslib.d.ts"]\r
107         }\r
108     }\r
109 }\r
110 ```\r
111 \r
112 For JSPM users:\r
113 \r
114 ```json\r
115 {\r
116     "compilerOptions": {\r
117         "module": "system",\r
118         "importHelpers": true,\r
119         "baseUrl": "./",\r
120         "paths": {\r
121             "tslib" : ["jspm_packages/npm/tslib@1.[version].0/tslib.d.ts"]\r
122         }\r
123     }\r
124 }\r
125 ```\r
126 \r
127 \r
128 # Contribute\r
129 \r
130 There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.\r
131 \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
137 \r
138 # Documentation\r
139 \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