Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-go / 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 3.9.2 or later\r
41 npm install tslib\r
42 \r
43 # TypeScript 3.8.4 or earlier\r
44 npm install tslib@^1\r
45 \r
46 # TypeScript 2.3.2 or earlier\r
47 npm install tslib@1.6.1\r
48 ```\r
49 \r
50 ## yarn\r
51 \r
52 ```sh\r
53 # TypeScript 3.9.2 or later\r
54 yarn add tslib\r
55 \r
56 # TypeScript 3.8.4 or earlier\r
57 yarn add tslib@^1\r
58 \r
59 # TypeScript 2.3.2 or earlier\r
60 yarn add tslib@1.6.1\r
61 ```\r
62 \r
63 ## bower\r
64 \r
65 ```sh\r
66 # TypeScript 3.9.2 or later\r
67 bower install tslib\r
68 \r
69 # TypeScript 3.8.4 or earlier\r
70 bower install tslib@^1\r
71 \r
72 # TypeScript 2.3.2 or earlier\r
73 bower install tslib@1.6.1\r
74 ```\r
75 \r
76 ## JSPM\r
77 \r
78 ```sh\r
79 # TypeScript 3.9.2 or later\r
80 jspm install tslib\r
81 \r
82 # TypeScript 3.8.4 or earlier\r
83 jspm install tslib@^1\r
84 \r
85 # TypeScript 2.3.2 or earlier\r
86 jspm install tslib@1.6.1\r
87 ```\r
88 \r
89 # Usage\r
90 \r
91 Set the `importHelpers` compiler option on the command line:\r
92 \r
93 ```\r
94 tsc --importHelpers file.ts\r
95 ```\r
96 \r
97 or in your tsconfig.json:\r
98 \r
99 ```json\r
100 {\r
101     "compilerOptions": {\r
102         "importHelpers": true\r
103     }\r
104 }\r
105 ```\r
106 \r
107 #### For bower and JSPM users\r
108 \r
109 You will need to add a `paths` mapping for `tslib`, e.g. For Bower users:\r
110 \r
111 ```json\r
112 {\r
113     "compilerOptions": {\r
114         "module": "amd",\r
115         "importHelpers": true,\r
116         "baseUrl": "./",\r
117         "paths": {\r
118             "tslib" : ["bower_components/tslib/tslib.d.ts"]\r
119         }\r
120     }\r
121 }\r
122 ```\r
123 \r
124 For JSPM users:\r
125 \r
126 ```json\r
127 {\r
128     "compilerOptions": {\r
129         "module": "system",\r
130         "importHelpers": true,\r
131         "baseUrl": "./",\r
132         "paths": {\r
133             "tslib" : ["jspm_packages/npm/tslib@2.x.y/tslib.d.ts"]\r
134         }\r
135     }\r
136 }\r
137 ```\r
138 \r
139 \r
140 # Contribute\r
141 \r
142 There are many ways to [contribute](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md) to TypeScript.\r
143 \r
144 * [Submit bugs](https://github.com/Microsoft/TypeScript/issues) and help us verify fixes as they are checked in.\r
145 * Review the [source code changes](https://github.com/Microsoft/TypeScript/pulls).\r
146 * Engage with other TypeScript users and developers on [StackOverflow](http://stackoverflow.com/questions/tagged/typescript).\r
147 * Join the [#typescript](http://twitter.com/#!/search/realtime/%23typescript) discussion on Twitter.\r
148 * [Contribute bug fixes](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).\r
149 \r
150 # Documentation\r
151 \r
152 * [Quick tutorial](http://www.typescriptlang.org/Tutorial)\r
153 * [Programming handbook](http://www.typescriptlang.org/Handbook)\r
154 * [Homepage](http://www.typescriptlang.org/)\r