angular-slickgrid 4.2.0 → 4.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) hide show
  1. package/LICENSE +20 -20
  2. package/{dist/app → app}/modules/angular-slickgrid/components/angular-slickgrid.component.d.ts +2 -2
  3. package/{dist/app → app}/modules/angular-slickgrid/constants.d.ts +0 -0
  4. package/{dist/app → app}/modules/angular-slickgrid/extensions/index.d.ts +0 -0
  5. package/{dist/app → app}/modules/angular-slickgrid/extensions/slickRowDetailView.d.ts +0 -2
  6. package/{dist/app → app}/modules/angular-slickgrid/global-grid-options.d.ts +0 -0
  7. package/{dist/app → app}/modules/angular-slickgrid/index.d.ts +0 -0
  8. package/{dist/app → app}/modules/angular-slickgrid/models/angularComponentOutput.interface.d.ts +0 -0
  9. package/{dist/app → app}/modules/angular-slickgrid/models/angularGridInstance.interface.d.ts +0 -0
  10. package/{dist/app → app}/modules/angular-slickgrid/models/externalTestingDependencies.interface.d.ts +0 -0
  11. package/{dist/app → app}/modules/angular-slickgrid/models/gridOption.interface.d.ts +0 -0
  12. package/{dist/app → app}/modules/angular-slickgrid/models/index.d.ts +0 -0
  13. package/{dist/app → app}/modules/angular-slickgrid/models/rowDetailView.interface.d.ts +0 -0
  14. package/{dist/app → app}/modules/angular-slickgrid/models/slickGrid.interface.d.ts +0 -0
  15. package/{dist/app → app}/modules/angular-slickgrid/modules/angular-slickgrid.module.d.ts +0 -0
  16. package/{dist/app → app}/modules/angular-slickgrid/services/angularUtil.service.d.ts +0 -0
  17. package/{dist/app → app}/modules/angular-slickgrid/services/bsDropdown.service.d.ts +0 -0
  18. package/{dist/app → app}/modules/angular-slickgrid/services/container.service.d.ts +1 -0
  19. package/{dist/app → app}/modules/angular-slickgrid/services/index.d.ts +0 -0
  20. package/{dist/app → app}/modules/angular-slickgrid/services/translater.service.d.ts +0 -0
  21. package/{dist/app → app}/modules/angular-slickgrid/services/utilities.d.ts +0 -0
  22. package/{dist/app → app}/modules/angular-slickgrid/slickgrid-config.d.ts +0 -0
  23. package/docs/assets/lib/multiple-select/README.md +17 -0
  24. package/{dist/esm2020 → esm2020}/angular-slickgrid.mjs +0 -0
  25. package/esm2020/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +1170 -0
  26. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/constants.mjs +1 -1
  27. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/extensions/index.mjs +1 -1
  28. package/esm2020/app/modules/angular-slickgrid/extensions/slickRowDetailView.mjs +298 -0
  29. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/global-grid-options.mjs +1 -1
  30. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/index.mjs +1 -1
  31. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/angularComponentOutput.interface.mjs +1 -1
  32. package/esm2020/app/modules/angular-slickgrid/models/angularGridInstance.interface.mjs +2 -0
  33. package/esm2020/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.mjs +2 -0
  34. package/esm2020/app/modules/angular-slickgrid/models/gridOption.interface.mjs +2 -0
  35. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/models/index.mjs +1 -1
  36. package/esm2020/app/modules/angular-slickgrid/models/rowDetailView.interface.mjs +2 -0
  37. package/esm2020/app/modules/angular-slickgrid/models/slickGrid.interface.mjs +2 -0
  38. package/esm2020/app/modules/angular-slickgrid/modules/angular-slickgrid.module.mjs +43 -0
  39. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/angularUtil.service.mjs +4 -4
  40. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/bsDropdown.service.mjs +4 -4
  41. package/esm2020/app/modules/angular-slickgrid/services/container.service.mjs +29 -0
  42. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/index.mjs +1 -1
  43. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/translater.service.mjs +4 -4
  44. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/services/utilities.mjs +1 -1
  45. package/{dist/esm2020 → esm2020}/app/modules/angular-slickgrid/slickgrid-config.mjs +1 -1
  46. package/{dist/esm2020 → esm2020}/public_api.mjs +1 -1
  47. package/{dist/fesm2015 → fesm2015}/angular-slickgrid.mjs +48 -51
  48. package/fesm2015/angular-slickgrid.mjs.map +1 -0
  49. package/{dist/fesm2020 → fesm2020}/angular-slickgrid.mjs +48 -51
  50. package/fesm2020/angular-slickgrid.mjs.map +1 -0
  51. package/{dist/i18n → i18n}/en.json +89 -89
  52. package/{dist/i18n → i18n}/fr.json +90 -90
  53. package/{dist/angular-slickgrid.d.ts → index.d.ts} +0 -0
  54. package/package.json +33 -118
  55. package/{dist/public_api.d.ts → public_api.d.ts} +0 -0
  56. package/test/cypress/node_modules/@cypress/request/README.md +1038 -0
  57. package/test/cypress/node_modules/@cypress/xvfb/README.md +48 -0
  58. package/test/cypress/node_modules/@cypress/xvfb/node_modules/debug/README.md +437 -0
  59. package/test/cypress/node_modules/@types/node/README.md +16 -0
  60. package/test/cypress/node_modules/@types/sinonjs__fake-timers/README.md +16 -0
  61. package/test/cypress/node_modules/@types/sizzle/README.md +16 -0
  62. package/test/cypress/node_modules/@types/yauzl/README.md +16 -0
  63. package/test/cypress/node_modules/@types/yauzl/node_modules/@types/node/README.md +16 -0
  64. package/test/cypress/node_modules/aggregate-error/README.md +61 -0
  65. package/test/cypress/node_modules/ansi-colors/README.md +315 -0
  66. package/test/cypress/node_modules/ansi-escapes/README.md +245 -0
  67. package/test/cypress/node_modules/ansi-regex/README.md +78 -0
  68. package/test/cypress/node_modules/ansi-styles/README.md +152 -0
  69. package/test/cypress/node_modules/arch/README.md +71 -0
  70. package/test/cypress/node_modules/asn1/README.md +50 -0
  71. package/test/cypress/node_modules/assert-plus/README.md +162 -0
  72. package/test/cypress/node_modules/astral-regex/README.md +46 -0
  73. package/test/cypress/node_modules/async/README.md +60 -0
  74. package/test/cypress/node_modules/asynckit/README.md +233 -0
  75. package/test/cypress/node_modules/at-least-node/README.md +25 -0
  76. package/test/cypress/node_modules/aws-sign2/README.md +4 -0
  77. package/test/cypress/node_modules/aws4/README.md +183 -0
  78. package/test/cypress/node_modules/balanced-match/README.md +91 -0
  79. package/test/cypress/node_modules/base64-js/README.md +34 -0
  80. package/test/cypress/node_modules/bcrypt-pbkdf/README.md +45 -0
  81. package/test/cypress/node_modules/blob-util/README.md +623 -0
  82. package/test/cypress/node_modules/bluebird/README.md +57 -0
  83. package/test/cypress/node_modules/brace-expansion/README.md +129 -0
  84. package/test/cypress/node_modules/buffer/README.md +410 -0
  85. package/test/cypress/node_modules/buffer-crc32/README.md +47 -0
  86. package/test/cypress/node_modules/cachedir/README.md +27 -0
  87. package/test/cypress/node_modules/caseless/README.md +45 -0
  88. package/test/cypress/node_modules/chalk/README.md +293 -0
  89. package/test/cypress/node_modules/chalk/node_modules/supports-color/README.md +76 -0
  90. package/test/cypress/node_modules/check-more-types/README.md +952 -0
  91. package/test/cypress/node_modules/ci-info/README.md +114 -0
  92. package/test/cypress/node_modules/clean-stack/README.md +76 -0
  93. package/test/cypress/node_modules/cli-cursor/README.md +55 -0
  94. package/test/cypress/node_modules/cli-table3/README.md +218 -0
  95. package/test/cypress/node_modules/cli-truncate/README.md +139 -0
  96. package/test/cypress/node_modules/color-convert/README.md +68 -0
  97. package/test/cypress/node_modules/color-name/README.md +11 -0
  98. package/test/cypress/node_modules/colorette/README.md +102 -0
  99. package/test/cypress/node_modules/colors/README.md +221 -0
  100. package/test/cypress/node_modules/combined-stream/README.md +138 -0
  101. package/test/cypress/node_modules/commander/README.md +737 -0
  102. package/test/cypress/node_modules/common-tags/README.md +687 -0
  103. package/test/cypress/node_modules/core-util-is/README.md +3 -0
  104. package/test/cypress/node_modules/cross-spawn/README.md +96 -0
  105. package/test/cypress/node_modules/cypress/README.md +25 -0
  106. package/test/cypress/node_modules/cypress/mount-utils/README.md +14 -0
  107. package/test/cypress/node_modules/cypress/react/README.md +414 -0
  108. package/test/cypress/node_modules/cypress/vue/README.md +678 -0
  109. package/test/cypress/node_modules/cypress/vue2/README.md +693 -0
  110. package/test/cypress/node_modules/dashdash/README.md +574 -0
  111. package/test/cypress/node_modules/dayjs/README.md +128 -0
  112. package/test/cypress/node_modules/debug/README.md +455 -0
  113. package/test/cypress/node_modules/delayed-stream/README.md +141 -0
  114. package/test/cypress/node_modules/ecc-jsbn/README.md +8 -0
  115. package/test/cypress/node_modules/emoji-regex/README.md +73 -0
  116. package/test/cypress/node_modules/end-of-stream/README.md +54 -0
  117. package/test/cypress/node_modules/enquirer/README.md +1752 -0
  118. package/test/cypress/node_modules/escape-string-regexp/README.md +27 -0
  119. package/test/cypress/node_modules/eventemitter2/README.md +809 -0
  120. package/test/cypress/node_modules/execa/README.md +656 -0
  121. package/test/cypress/node_modules/executable/README.md +64 -0
  122. package/test/cypress/node_modules/extend/README.md +81 -0
  123. package/test/cypress/node_modules/extract-zip/README.md +57 -0
  124. package/test/cypress/node_modules/extract-zip/node_modules/debug/README.md +455 -0
  125. package/test/cypress/node_modules/extsprintf/README.md +46 -0
  126. package/test/cypress/node_modules/fd-slicer/README.md +199 -0
  127. package/test/cypress/node_modules/figures/README.md +139 -0
  128. package/test/cypress/node_modules/forever-agent/README.md +4 -0
  129. package/test/cypress/node_modules/form-data/README.md +234 -0
  130. package/test/cypress/node_modules/fs-extra/README.md +264 -0
  131. package/test/cypress/node_modules/fs.realpath/README.md +33 -0
  132. package/test/cypress/node_modules/get-stream/README.md +124 -0
  133. package/test/cypress/node_modules/getos/README.md +79 -0
  134. package/test/cypress/node_modules/getpass/README.md +32 -0
  135. package/test/cypress/node_modules/glob/README.md +375 -0
  136. package/test/cypress/node_modules/global-dirs/README.md +72 -0
  137. package/test/cypress/node_modules/graceful-fs/README.md +133 -0
  138. package/test/cypress/node_modules/has-flag/README.md +89 -0
  139. package/test/cypress/node_modules/http-signature/README.md +80 -0
  140. package/test/cypress/node_modules/human-signals/README.md +155 -0
  141. package/test/cypress/node_modules/ieee754/README.md +51 -0
  142. package/test/cypress/node_modules/indent-string/README.md +70 -0
  143. package/test/cypress/node_modules/inflight/README.md +37 -0
  144. package/test/cypress/node_modules/inherits/README.md +42 -0
  145. package/test/cypress/node_modules/ini/README.md +102 -0
  146. package/test/cypress/node_modules/is-ci/README.md +50 -0
  147. package/test/cypress/node_modules/is-fullwidth-code-point/README.md +39 -0
  148. package/test/cypress/node_modules/is-installed-globally/README.md +31 -0
  149. package/test/cypress/node_modules/is-path-inside/README.md +63 -0
  150. package/test/cypress/node_modules/is-stream/README.md +57 -0
  151. package/test/cypress/node_modules/is-typedarray/README.md +16 -0
  152. package/test/cypress/node_modules/isexe/README.md +51 -0
  153. package/test/cypress/node_modules/isstream/README.md +66 -0
  154. package/test/cypress/node_modules/jsbn/README.md +175 -0
  155. package/test/cypress/node_modules/json-schema/README.md +3 -0
  156. package/test/cypress/node_modules/json-stringify-safe/README.md +52 -0
  157. package/test/cypress/node_modules/jsonfile/README.md +205 -0
  158. package/test/cypress/node_modules/jsonfile/node_modules/universalify/README.md +76 -0
  159. package/test/cypress/node_modules/jsprim/README.md +287 -0
  160. package/test/cypress/node_modules/lazy-ass/README.md +269 -0
  161. package/test/cypress/node_modules/listr2/README.md +17 -0
  162. package/test/cypress/node_modules/lodash/README.md +39 -0
  163. package/test/cypress/node_modules/lodash.once/README.md +18 -0
  164. package/test/cypress/node_modules/log-symbols/README.md +51 -0
  165. package/test/cypress/node_modules/log-update/README.md +97 -0
  166. package/test/cypress/node_modules/log-update/node_modules/slice-ansi/README.md +66 -0
  167. package/test/cypress/node_modules/log-update/node_modules/wrap-ansi/README.md +97 -0
  168. package/test/cypress/node_modules/lru-cache/README.md +166 -0
  169. package/test/cypress/node_modules/merge-stream/README.md +78 -0
  170. package/test/cypress/node_modules/mime-db/README.md +102 -0
  171. package/test/cypress/node_modules/mime-types/README.md +123 -0
  172. package/test/cypress/node_modules/mimic-fn/README.md +69 -0
  173. package/test/cypress/node_modules/minimatch/README.md +209 -0
  174. package/test/cypress/node_modules/ms/README.md +60 -0
  175. package/test/cypress/node_modules/npm-run-path/README.md +115 -0
  176. package/test/cypress/node_modules/once/README.md +79 -0
  177. package/test/cypress/node_modules/onetime/README.md +94 -0
  178. package/test/cypress/node_modules/ospath/README.md +53 -0
  179. package/test/cypress/node_modules/p-map/README.md +89 -0
  180. package/test/cypress/node_modules/path-is-absolute/README.md +59 -0
  181. package/test/cypress/node_modules/path-key/README.md +61 -0
  182. package/test/cypress/node_modules/pend/README.md +41 -0
  183. package/test/cypress/node_modules/performance-now/README.md +30 -0
  184. package/test/cypress/node_modules/pify/README.md +119 -0
  185. package/test/cypress/node_modules/pretty-bytes/README.md +131 -0
  186. package/test/cypress/node_modules/proxy-from-env/README.md +131 -0
  187. package/test/cypress/node_modules/psl/README.md +215 -0
  188. package/test/cypress/node_modules/pump/README.md +65 -0
  189. package/test/cypress/node_modules/punycode/README.md +122 -0
  190. package/test/cypress/node_modules/qs/README.md +475 -0
  191. package/test/cypress/node_modules/request-progress/README.md +78 -0
  192. package/test/cypress/node_modules/restore-cursor/README.md +26 -0
  193. package/test/cypress/node_modules/rimraf/README.md +101 -0
  194. package/test/cypress/node_modules/rxjs/README.md +147 -0
  195. package/test/cypress/node_modules/rxjs/_esm2015/README.md +147 -0
  196. package/test/cypress/node_modules/rxjs/_esm5/README.md +147 -0
  197. package/test/cypress/node_modules/rxjs/src/README.md +147 -0
  198. package/test/cypress/node_modules/safe-buffer/README.md +584 -0
  199. package/test/cypress/node_modules/safer-buffer/README.md +156 -0
  200. package/test/cypress/node_modules/semver/README.md +566 -0
  201. package/test/cypress/node_modules/shebang-command/README.md +34 -0
  202. package/test/cypress/node_modules/shebang-regex/README.md +33 -0
  203. package/test/cypress/node_modules/signal-exit/README.md +39 -0
  204. package/test/cypress/node_modules/slice-ansi/README.md +72 -0
  205. package/test/cypress/node_modules/sshpk/README.md +804 -0
  206. package/test/cypress/node_modules/string-width/README.md +50 -0
  207. package/test/cypress/node_modules/strip-ansi/README.md +46 -0
  208. package/test/cypress/node_modules/strip-final-newline/README.md +30 -0
  209. package/test/cypress/node_modules/supports-color/README.md +77 -0
  210. package/test/cypress/node_modules/throttleit/README.md +32 -0
  211. package/test/cypress/node_modules/tmp/README.md +365 -0
  212. package/test/cypress/node_modules/tough-cookie/README.md +527 -0
  213. package/test/cypress/node_modules/tslib/README.md +142 -0
  214. package/test/cypress/node_modules/tunnel-agent/README.md +4 -0
  215. package/test/cypress/node_modules/tweetnacl/README.md +459 -0
  216. package/test/cypress/node_modules/type-fest/README.md +760 -0
  217. package/test/cypress/node_modules/universalify/README.md +76 -0
  218. package/test/cypress/node_modules/untildify/README.md +30 -0
  219. package/test/cypress/node_modules/uuid/README.md +505 -0
  220. package/test/cypress/node_modules/verror/README.md +528 -0
  221. package/test/cypress/node_modules/verror/node_modules/extsprintf/README.md +46 -0
  222. package/test/cypress/node_modules/which/README.md +54 -0
  223. package/test/cypress/node_modules/wrap-ansi/README.md +91 -0
  224. package/test/cypress/node_modules/wrappy/README.md +36 -0
  225. package/test/cypress/node_modules/yallist/README.md +204 -0
  226. package/test/cypress/node_modules/yauzl/README.md +658 -0
  227. package/.browserslistrc +0 -12
  228. package/.codecov.yml +0 -17
  229. package/.editorconfig +0 -18
  230. package/.eslintrc.json +0 -50
  231. package/.github/CODE_OF_CONDUCT.md +0 -76
  232. package/.github/FUNDING.yml +0 -8
  233. package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -54
  234. package/.github/ISSUE_TEMPLATE/config.yml +0 -5
  235. package/.github/ISSUE_TEMPLATE/feature_request.yml +0 -44
  236. package/.github/renovate.json5 +0 -26
  237. package/.github/stale.yml +0 -7
  238. package/.github/workflows/main.yml +0 -83
  239. package/.vscode/extensions.json +0 -9
  240. package/.vscode/launch.json +0 -72
  241. package/.vscode/settings.json +0 -7
  242. package/.vscode/tasks.json +0 -77
  243. package/CHANGELOG.md +0 -1172
  244. package/angular.json +0 -148
  245. package/dist/LICENSE +0 -20
  246. package/dist/README.md +0 -182
  247. package/dist/esm2020/app/modules/angular-slickgrid/components/angular-slickgrid.component.mjs +0 -1171
  248. package/dist/esm2020/app/modules/angular-slickgrid/extensions/slickRowDetailView.mjs +0 -300
  249. package/dist/esm2020/app/modules/angular-slickgrid/models/angularGridInstance.interface.mjs +0 -2
  250. package/dist/esm2020/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.mjs +0 -2
  251. package/dist/esm2020/app/modules/angular-slickgrid/models/gridOption.interface.mjs +0 -2
  252. package/dist/esm2020/app/modules/angular-slickgrid/models/rowDetailView.interface.mjs +0 -2
  253. package/dist/esm2020/app/modules/angular-slickgrid/models/slickGrid.interface.mjs +0 -2
  254. package/dist/esm2020/app/modules/angular-slickgrid/modules/angular-slickgrid.module.mjs +0 -46
  255. package/dist/esm2020/app/modules/angular-slickgrid/services/container.service.mjs +0 -26
  256. package/dist/fesm2015/angular-slickgrid.mjs.map +0 -1
  257. package/dist/fesm2020/angular-slickgrid.mjs.map +0 -1
  258. package/dist/package.json +0 -79
  259. package/global.d.ts +0 -1
  260. package/ngcc.config.js +0 -13
  261. package/screenshots/column-picker.png +0 -0
  262. package/screenshots/composite-editor.png +0 -0
  263. package/screenshots/draggable-grouping.png +0 -0
  264. package/screenshots/editors.png +0 -0
  265. package/screenshots/export-to-file.png +0 -0
  266. package/screenshots/filter_and_sort.png +0 -0
  267. package/screenshots/formatters.png +0 -0
  268. package/screenshots/frozen.png +0 -0
  269. package/screenshots/multipleSelectFilter.png +0 -0
  270. package/screenshots/pagination.png +0 -0
  271. package/screenshots/selectFilter.png +0 -0
  272. package/screenshots/singleFilter.png +0 -0
  273. package/src/app/app-routing.module.ts +0 -83
  274. package/src/app/app.component.html +0 -160
  275. package/src/app/app.component.scss +0 -65
  276. package/src/app/app.component.ts +0 -10
  277. package/src/app/app.module.ts +0 -175
  278. package/src/app/examples/custom-angularComponentEditor.ts +0 -184
  279. package/src/app/examples/custom-angularComponentFilter.ts +0 -126
  280. package/src/app/examples/custom-inputEditor.ts +0 -124
  281. package/src/app/examples/custom-inputFilter.ts +0 -142
  282. package/src/app/examples/custom-titleFormatter.component.ts +0 -8
  283. package/src/app/examples/editor-ng-select.component.ts +0 -37
  284. package/src/app/examples/filter-ng-select.component.ts +0 -32
  285. package/src/app/examples/grid-additem.component.html +0 -48
  286. package/src/app/examples/grid-additem.component.ts +0 -272
  287. package/src/app/examples/grid-angular.component.html +0 -79
  288. package/src/app/examples/grid-angular.component.scss +0 -28
  289. package/src/app/examples/grid-angular.component.ts +0 -370
  290. package/src/app/examples/grid-autoheight.component.html +0 -52
  291. package/src/app/examples/grid-autoheight.component.ts +0 -147
  292. package/src/app/examples/grid-basic.component.html +0 -29
  293. package/src/app/examples/grid-basic.component.ts +0 -82
  294. package/src/app/examples/grid-clientside.component.html +0 -51
  295. package/src/app/examples/grid-clientside.component.ts +0 -293
  296. package/src/app/examples/grid-colspan.component.html +0 -39
  297. package/src/app/examples/grid-colspan.component.scss +0 -11
  298. package/src/app/examples/grid-colspan.component.ts +0 -155
  299. package/src/app/examples/grid-composite-editor.component.html +0 -79
  300. package/src/app/examples/grid-composite-editor.component.scss +0 -19
  301. package/src/app/examples/grid-composite-editor.component.ts +0 -948
  302. package/src/app/examples/grid-contextmenu.component.html +0 -62
  303. package/src/app/examples/grid-contextmenu.component.scss +0 -44
  304. package/src/app/examples/grid-contextmenu.component.ts +0 -473
  305. package/src/app/examples/grid-custom-tooltip.component.html +0 -25
  306. package/src/app/examples/grid-custom-tooltip.component.scss +0 -77
  307. package/src/app/examples/grid-custom-tooltip.component.ts +0 -483
  308. package/src/app/examples/grid-draggrouping.component.html +0 -93
  309. package/src/app/examples/grid-draggrouping.component.ts +0 -397
  310. package/src/app/examples/grid-editor.component.html +0 -88
  311. package/src/app/examples/grid-editor.component.ts +0 -699
  312. package/src/app/examples/grid-formatter.component.html +0 -26
  313. package/src/app/examples/grid-formatter.component.ts +0 -162
  314. package/src/app/examples/grid-frozen.component.html +0 -65
  315. package/src/app/examples/grid-frozen.component.scss +0 -11
  316. package/src/app/examples/grid-frozen.component.ts +0 -303
  317. package/src/app/examples/grid-graphql-nopage.component.html +0 -33
  318. package/src/app/examples/grid-graphql-nopage.component.scss +0 -9
  319. package/src/app/examples/grid-graphql-nopage.component.ts +0 -242
  320. package/src/app/examples/grid-graphql.component.html +0 -87
  321. package/src/app/examples/grid-graphql.component.ts +0 -304
  322. package/src/app/examples/grid-grouping.component.html +0 -80
  323. package/src/app/examples/grid-grouping.component.ts +0 -313
  324. package/src/app/examples/grid-headerbutton.component.html +0 -31
  325. package/src/app/examples/grid-headerbutton.component.scss +0 -10
  326. package/src/app/examples/grid-headerbutton.component.ts +0 -233
  327. package/src/app/examples/grid-headermenu.component.html +0 -31
  328. package/src/app/examples/grid-headermenu.component.scss +0 -25
  329. package/src/app/examples/grid-headermenu.component.ts +0 -159
  330. package/src/app/examples/grid-localization.component.html +0 -54
  331. package/src/app/examples/grid-localization.component.ts +0 -293
  332. package/src/app/examples/grid-menu.component.html +0 -37
  333. package/src/app/examples/grid-menu.component.scss +0 -28
  334. package/src/app/examples/grid-menu.component.ts +0 -229
  335. package/src/app/examples/grid-odata.component.html +0 -116
  336. package/src/app/examples/grid-odata.component.ts +0 -441
  337. package/src/app/examples/grid-range.component.html +0 -74
  338. package/src/app/examples/grid-range.component.ts +0 -291
  339. package/src/app/examples/grid-remote.component.html +0 -37
  340. package/src/app/examples/grid-remote.component.ts +0 -153
  341. package/src/app/examples/grid-resize-by-content.component.html +0 -62
  342. package/src/app/examples/grid-resize-by-content.component.scss +0 -19
  343. package/src/app/examples/grid-resize-by-content.component.ts +0 -780
  344. package/src/app/examples/grid-rowdetail.component.html +0 -35
  345. package/src/app/examples/grid-rowdetail.component.ts +0 -205
  346. package/src/app/examples/grid-rowmove.component.html +0 -49
  347. package/src/app/examples/grid-rowmove.component.ts +0 -234
  348. package/src/app/examples/grid-rowselection.component.html +0 -76
  349. package/src/app/examples/grid-rowselection.component.ts +0 -267
  350. package/src/app/examples/grid-state.component.html +0 -36
  351. package/src/app/examples/grid-state.component.ts +0 -259
  352. package/src/app/examples/grid-tabs.component.html +0 -35
  353. package/src/app/examples/grid-tabs.component.ts +0 -115
  354. package/src/app/examples/grid-trading.component.html +0 -58
  355. package/src/app/examples/grid-trading.component.scss +0 -49
  356. package/src/app/examples/grid-trading.component.ts +0 -319
  357. package/src/app/examples/grid-tree-data-hierarchical.component.html +0 -79
  358. package/src/app/examples/grid-tree-data-hierarchical.component.scss +0 -47
  359. package/src/app/examples/grid-tree-data-hierarchical.component.ts +0 -311
  360. package/src/app/examples/grid-tree-data-parent-child.component.html +0 -108
  361. package/src/app/examples/grid-tree-data-parent-child.component.scss +0 -10
  362. package/src/app/examples/grid-tree-data-parent-child.component.ts +0 -351
  363. package/src/app/examples/home.component.html +0 -41
  364. package/src/app/examples/home.component.ts +0 -9
  365. package/src/app/examples/rowdetail-preload.component.ts +0 -10
  366. package/src/app/examples/rowdetail-view.component.html +0 -36
  367. package/src/app/examples/rowdetail-view.component.ts +0 -54
  368. package/src/app/examples/swt-common-grid-pagination.component.ts +0 -156
  369. package/src/app/examples/swt-common-grid-test.component.html +0 -30
  370. package/src/app/examples/swt-common-grid-test.component.ts +0 -219
  371. package/src/app/examples/swt-common-grid.component.ts +0 -436
  372. package/src/app/examples/swt-logger.service.ts +0 -165
  373. package/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.html +0 -4
  374. package/src/app/modules/angular-slickgrid/components/angular-slickgrid.component.ts +0 -1395
  375. package/src/app/modules/angular-slickgrid/constants.ts +0 -97
  376. package/src/app/modules/angular-slickgrid/extensions/index.ts +0 -1
  377. package/src/app/modules/angular-slickgrid/extensions/slickRowDetailView.ts +0 -375
  378. package/src/app/modules/angular-slickgrid/global-grid-options.ts +0 -245
  379. package/src/app/modules/angular-slickgrid/index.ts +0 -11
  380. package/src/app/modules/angular-slickgrid/models/angularComponentOutput.interface.ts +0 -6
  381. package/src/app/modules/angular-slickgrid/models/angularGridInstance.interface.ts +0 -68
  382. package/src/app/modules/angular-slickgrid/models/externalTestingDependencies.interface.ts +0 -37
  383. package/src/app/modules/angular-slickgrid/models/gridOption.interface.ts +0 -12
  384. package/src/app/modules/angular-slickgrid/models/index.ts +0 -6
  385. package/src/app/modules/angular-slickgrid/models/rowDetailView.interface.ts +0 -33
  386. package/src/app/modules/angular-slickgrid/models/slickGrid.interface.ts +0 -7
  387. package/src/app/modules/angular-slickgrid/modules/angular-slickgrid.module.ts +0 -37
  388. package/src/app/modules/angular-slickgrid/services/angularUtil.service.ts +0 -48
  389. package/src/app/modules/angular-slickgrid/services/bsDropdown.service.ts +0 -142
  390. package/src/app/modules/angular-slickgrid/services/container.service.ts +0 -24
  391. package/src/app/modules/angular-slickgrid/services/index.ts +0 -5
  392. package/src/app/modules/angular-slickgrid/services/translater.service.ts +0 -38
  393. package/src/app/modules/angular-slickgrid/services/utilities.ts +0 -19
  394. package/src/app/modules/angular-slickgrid/slickgrid-config.ts +0 -10
  395. package/src/app/slickgrid-custom-variables.scss +0 -10
  396. package/src/assets/.gitkeep +0 -0
  397. package/src/assets/data/collection_100_numbers.json +0 -12
  398. package/src/assets/data/collection_500_numbers.json +0 -52
  399. package/src/assets/data/countries.json +0 -245
  400. package/src/assets/data/country_names.json +0 -245
  401. package/src/assets/data/customers_100.json +0 -102
  402. package/src/assets/i18n/en.json +0 -90
  403. package/src/assets/i18n/fr.json +0 -91
  404. package/src/environments/environment.prod.ts +0 -3
  405. package/src/environments/environment.ts +0 -8
  406. package/src/favicon.ico +0 -0
  407. package/src/index.html +0 -18
  408. package/src/main.ts +0 -13
  409. package/src/polyfills.ts +0 -52
  410. package/src/public_api.ts +0 -1
  411. package/src/styles.scss +0 -66
  412. package/src/typings.d.ts +0 -10
  413. package/tsconfig.app.json +0 -25
  414. package/tsconfig.json +0 -40
  415. package/tsconfig.spec.json +0 -23
@@ -0,0 +1,760 @@
1
+ <div align="center">
2
+ <br>
3
+ <br>
4
+ <img src="media/logo.svg" alt="type-fest" height="300">
5
+ <br>
6
+ <br>
7
+ <b>A collection of essential TypeScript types</b>
8
+ <br>
9
+ <br>
10
+ <br>
11
+ <br>
12
+ <div align="center">
13
+ <p>
14
+ <p>
15
+ <sup>
16
+ <a href="https://github.com/sponsors/sindresorhus">Sindre Sorhus' open source work is supported by the community</a>
17
+ </sup>
18
+ </p>
19
+ <sup>Special thanks to:</sup>
20
+ <br>
21
+ <br>
22
+ <a href="https://standardresume.co/tech">
23
+ <img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="180"/>
24
+ </a>
25
+ </p>
26
+ </div>
27
+ <br>
28
+ <hr>
29
+ </div>
30
+ <br>
31
+ <br>
32
+
33
+ [![](https://img.shields.io/badge/unicorn-approved-ff69b4.svg)](https://giphy.com/gifs/illustration-rainbow-unicorn-26AHG5KGFxSkUWw1i)
34
+ [![npm dependents](https://badgen.net/npm/dependents/type-fest)](https://www.npmjs.com/package/type-fest?activeTab=dependents) [![npm downloads](https://badgen.net/npm/dt/type-fest)](https://www.npmjs.com/package/type-fest)
35
+
36
+ Many of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
37
+
38
+ Either add this package as a dependency or copy-paste the needed types. No credit required. 👌
39
+
40
+ PR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first.
41
+
42
+ ## Install
43
+
44
+ ```
45
+ $ npm install type-fest
46
+ ```
47
+
48
+ *Requires TypeScript >=3.4*
49
+
50
+ ## Usage
51
+
52
+ ```ts
53
+ import {Except} from 'type-fest';
54
+
55
+ type Foo = {
56
+ unicorn: string;
57
+ rainbow: boolean;
58
+ };
59
+
60
+ type FooWithoutRainbow = Except<Foo, 'rainbow'>;
61
+ //=> {unicorn: string}
62
+ ```
63
+
64
+ ## API
65
+
66
+ Click the type names for complete docs.
67
+
68
+ ### Basic
69
+
70
+ - [`Primitive`](source/basic.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
71
+ - [`Class`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
72
+ - [`TypedArray`](source/typed-array.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
73
+ - [`JsonObject`](source/basic.d.ts) - Matches a JSON object.
74
+ - [`JsonArray`](source/basic.d.ts) - Matches a JSON array.
75
+ - [`JsonValue`](source/basic.d.ts) - Matches any valid JSON value.
76
+ - [`ObservableLike`](source/basic.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
77
+
78
+ ### Utilities
79
+
80
+ - [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type).
81
+ - [`Mutable`](source/mutable.d.ts) - Create a type that strips `readonly` from all or some of an object's keys. The inverse of `Readonly<T>`.
82
+ - [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type.
83
+ - [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys.
84
+ - [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys.
85
+ - [`RequireExactlyOne`](source/require-exactly-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more.
86
+ - [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) if you only need one level deep.
87
+ - [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) if you only need one level deep.
88
+ - [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).
89
+ - [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`.
90
+ - [`Opaque`](source/opaque.d.ts) - Create an [opaque type](https://codemix.com/opaque-types-in-javascript/).
91
+ - [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional.
92
+ - [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required.
93
+ - [`ValueOf`](source/value-of.d.ts) - Create a union of the given object's values, and optionally specify which keys to get the values from.
94
+ - [`PromiseValue`](source/promise-value.d.ts) - Returns the type that is wrapped inside a `Promise`.
95
+ - [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`.
96
+ - [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract keys from a shape where values extend the given `Condition` type.
97
+ - [`ConditionalPick`](source/conditional-pick.d.ts) - Like `Pick` except it selects properties from a shape where the values extend the given `Condition` type.
98
+ - [`ConditionalExcept`](source/conditional-except.d.ts) - Like `Omit` except it removes properties from a shape where the values extend the given `Condition` type.
99
+ - [`UnionToIntersection`](source/union-to-intersection.d.ts) - Convert a union type to an intersection type.
100
+ - [`Stringified`](source/stringified.d.ts) - Create a type with the keys of the given type changed to `string` type.
101
+ - [`FixedLengthArray`](source/fixed-length-array.d.ts) - Create a type that represents an array of the given type and length.
102
+ - [`IterableElement`](source/iterable-element.d.ts) - Get the element type of an `Iterable`/`AsyncIterable`. For example, an array or a generator.
103
+ - [`Entry`](source/entry.d.ts) - Create a type that represents the type of an entry of a collection.
104
+ - [`Entries`](source/entries.d.ts) - Create a type that represents the type of the entries of a collection.
105
+ - [`SetReturnType`](source/set-return-type.d.ts) - Create a function type with a return type of your choice and the same parameters as the given function type.
106
+ - [`Asyncify`](source/asyncify.d.ts) - Create an async version of the given function type.
107
+
108
+ ### Template literal types
109
+
110
+ *Note:* These require [TypeScript 4.1 or newer](https://devblogs.microsoft.com/typescript/announcing-typescript-4-1/#template-literal-types).
111
+
112
+ - [`CamelCase`](ts41/camel-case.d.ts) – Convert a string literal to camel-case (`fooBar`).
113
+ - [`KebabCase`](ts41/kebab-case.d.ts) – Convert a string literal to kebab-case (`foo-bar`).
114
+ - [`PascalCase`](ts41/pascal-case.d.ts) – Converts a string literal to pascal-case (`FooBar`)
115
+ - [`SnakeCase`](ts41/snake-case.d.ts) – Convert a string literal to snake-case (`foo_bar`).
116
+ - [`DelimiterCase`](ts41/delimiter-case.d.ts) – Convert a string literal to a custom string delimiter casing.
117
+ - [`Get`](ts41/get.d.ts) - Get a deeply-nested property from an object using a key path, like [Lodash's `.get()`](https://lodash.com/docs/latest#get) function.
118
+
119
+ ### Miscellaneous
120
+
121
+ - [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file).
122
+ - [`TsConfigJson`](source/tsconfig-json.d.ts) - Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 3.7).
123
+
124
+ ## Declined types
125
+
126
+ *If we decline a type addition, we will make sure to document the better solution here.*
127
+
128
+ - [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The PR author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider.
129
+ - [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary<number>` vs `Record<string, number>`) from [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now.
130
+ - [`SubType`](https://github.com/sindresorhus/type-fest/issues/22) - The type is powerful, but lacks good use-cases and is prone to misuse.
131
+ - [`ExtractProperties` and `ExtractMethods`](https://github.com/sindresorhus/type-fest/pull/4) - The types violate the single responsibility principle. Instead, refine your types into more granular type hierarchies.
132
+
133
+ ## Tips
134
+
135
+ ### Built-in types
136
+
137
+ There are many advanced types most users don't know about.
138
+
139
+ - [`Partial<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) - Make all properties in `T` optional.
140
+ <details>
141
+ <summary>
142
+ Example
143
+ </summary>
144
+
145
+ [Playground](https://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgHIHsAmEDC6QzADmyA3gLABQyycADnanALYQBcyAzmFKEQNxUaddFDAcQAV2YAjaIMoBfKlQQAbOJ05osEAIIMAQpOBrsUMkOR1eANziRkCfISKSoD4Pg4ZseAsTIALyW1DS0DEysHADkvvoMMQA0VsKi4sgAzAAMuVaKClY2wPaOknSYDrguADwA0sgQAB6QIJjaANYQAJ7oMDp+LsQAfAAUXd0cdUnI9mo+uv6uANp1ALoAlKHhyGAAFsCcAHTOAW4eYF4gyxNrwbNwago0ypRWp66jH8QcAApwYmAjxq8SWIy2FDCNDA3ToKFBQyIdR69wmfQG1TOhShyBgomQX3w3GQE2Q6IA8jIAFYQBBgI4TTiEs5bTQYsFInrLTbbHZOIlgZDlSqQABqj0kKBC3yINx6a2xfOQwH6o2FVXFaklwSCIUkbQghBAEEwENSfNOlykEGefNe5uhB2O6sgS3GPRmLogmslG1tLxUOKgEDA7hAuydtteryAA)
146
+
147
+ ```ts
148
+ interface NodeConfig {
149
+ appName: string;
150
+ port: number;
151
+ }
152
+
153
+ class NodeAppBuilder {
154
+ private configuration: NodeConfig = {
155
+ appName: 'NodeApp',
156
+ port: 3000
157
+ };
158
+
159
+ private updateConfig<Key extends keyof NodeConfig>(key: Key, value: NodeConfig[Key]) {
160
+ this.configuration[key] = value;
161
+ }
162
+
163
+ config(config: Partial<NodeConfig>) {
164
+ type NodeConfigKey = keyof NodeConfig;
165
+
166
+ for (const key of Object.keys(config) as NodeConfigKey[]) {
167
+ const updateValue = config[key];
168
+
169
+ if (updateValue === undefined) {
170
+ continue;
171
+ }
172
+
173
+ this.updateConfig(key, updateValue);
174
+ }
175
+
176
+ return this;
177
+ }
178
+ }
179
+
180
+ // `Partial<NodeConfig>`` allows us to provide only a part of the
181
+ // NodeConfig interface.
182
+ new NodeAppBuilder().config({appName: 'ToDoApp'});
183
+ ```
184
+ </details>
185
+
186
+ - [`Required<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1408-L1413) - Make all properties in `T` required.
187
+ <details>
188
+ <summary>
189
+ Example
190
+ </summary>
191
+
192
+ [Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgGED21VQGJZwC2wA3gFCjXAzFJgA2A-AFzADOUckA5gNxUaIYjA4ckvGG07c+g6gF8KQkAgCuEFFDA5O6gEbEwUbLm2ESwABQIixACJIoSdgCUYAR3Vg4MACYAPGYuFvYAfACU5Ko0APRxwADKMBD+wFAAFuh2Vv7OSBlYGdmc8ABu8LHKsRyGxqY4oQT21pTCIHQMjOwA5DAAHgACxAAOjDAAdChYxL0ANLHUouKSMH0AEmAAhJhY6ozpAJ77GTCMjMCiV0ToSAb7UJPPC9WRgrEJwAAqR6MwSRQPFGUFocDgRHYxnEfGAowh-zgUCOwF6KwkUl6tXqJhCeEsxDaS1AXSYfUGI3GUxmc0WSneQA)
193
+
194
+ ```ts
195
+ interface ContactForm {
196
+ email?: string;
197
+ message?: string;
198
+ }
199
+
200
+ function submitContactForm(formData: Required<ContactForm>) {
201
+ // Send the form data to the server.
202
+ }
203
+
204
+ submitContactForm({
205
+ email: 'ex@mple.com',
206
+ message: 'Hi! Could you tell me more about…',
207
+ });
208
+
209
+ // TypeScript error: missing property 'message'
210
+ submitContactForm({
211
+ email: 'ex@mple.com',
212
+ });
213
+ ```
214
+ </details>
215
+
216
+ - [`Readonly<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) - Make all properties in `T` readonly.
217
+ <details>
218
+ <summary>
219
+ Example
220
+ </summary>
221
+
222
+ [Playground](https://typescript-play.js.org/?target=6#code/AQ4UwOwVwW2AZA9gc3mAbmANsA3gKFCOAHkAzMgGkOJABEwAjKZa2kAUQCcvEu32AMQCGAF2FYBIAL4BufDRABLCKLBcywgMZgEKZOoDCiCGSXI8i4hGEwwALmABnUVxXJ57YFgzZHSVF8sT1BpBSItLGEnJz1kAy5LLy0TM2RHACUwYQATEywATwAeAITjU3MAPnkrCJMXLigtUT4AClxgGztKbyDgaX99I1TzAEokr1BRAAslJwA6FIqLAF48TtswHp9MHDla9hJGACswZvmyLjAwAC8wVpm5xZHkUZDaMKIwqyWXYCW0oN4sNlsA1h0ug5gAByACyBQAggAHJHQ7ZBIFoXbzBjMCz7OoQP5YIaJNYQMAAdziCVaALGNSIAHomcAACoFJFgADKWjcSNEwG4vC4ji0wggEEQguiTnMEGALWAV1yAFp8gVgEjeFyuKICvMrCTgVxnst5jtsGC4ljsPNhXxGaAWcAAOq6YRXYDCRg+RWIcA5JSC+kWdCepQ+v3RYCU3RInzRMCGwlpC19NYBW1Ye08R1AA)
223
+
224
+ ```ts
225
+ enum LogLevel {
226
+ Off,
227
+ Debug,
228
+ Error,
229
+ Fatal
230
+ };
231
+
232
+ interface LoggerConfig {
233
+ name: string;
234
+ level: LogLevel;
235
+ }
236
+
237
+ class Logger {
238
+ config: Readonly<LoggerConfig>;
239
+
240
+ constructor({name, level}: LoggerConfig) {
241
+ this.config = {name, level};
242
+ Object.freeze(this.config);
243
+ }
244
+ }
245
+
246
+ const config: LoggerConfig = {
247
+ name: 'MyApp',
248
+ level: LogLevel.Debug
249
+ };
250
+
251
+ const logger = new Logger(config);
252
+
253
+ // TypeScript Error: cannot assign to read-only property.
254
+ logger.config.level = LogLevel.Error;
255
+
256
+ // We are able to edit config variable as we please.
257
+ config.level = LogLevel.Error;
258
+ ```
259
+ </details>
260
+
261
+ - [`Pick<T, K>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1422-L1427) - From `T`, pick a set of properties whose keys are in the union `K`.
262
+ <details>
263
+ <summary>
264
+ Example
265
+ </summary>
266
+
267
+ [Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgEE5TCgNugN4BQoZwOUBAXMAM5RyQDmA3KeSFABYCuAtgCMISMHloMmENh04oA9tBjQJjFuzIBfYrOAB6PcADCcGElh1gEGAHcKATwAO6ebyjB5CTNlwFwSxFR0BX5HeToYABNgBDh5fm8cfBg6AHIKG3ldA2BHOOcfFNpUygJ0pAhokr4hETFUgDpswywkggAFUwA3MFtgAF5gQgowKhhVKTYKGuFRcXo1aVZgbTIoJ3RW3xhOmB6+wfbcAGsAHi3kgBpgEtGy4AAfG54BWfqAPnZm4AAlZUj4MAkMA8GAGB4vEgfMlLLw6CwPBA8PYRmMgZVgAC6CgmI4cIommQELwICh8RBgKZKvALh1ur0bHQABR5PYMui0Wk7em2ADaAF0AJS0AASABUALIAGQAogR+Mp3CROCAFBBwVC2ikBpj5CgBIqGjizLA5TAFdAmalImAuqlBRoVQh5HBgEy1eDWfs7J5cjzGYKhroVfpDEhHM4MV6GRR5NN0JrtnRg6BVirTFBeHAKYmYY6QNpdB73LmCJZBlSAXAubtvczeSmQMNSuMbmKNgBlHFgPEUNwusBIPAAQlS1xetTmxT0SDoESgdD0C4aACtHMwxytLrohawgA)
268
+
269
+ ```ts
270
+ interface Article {
271
+ title: string;
272
+ thumbnail: string;
273
+ content: string;
274
+ }
275
+
276
+ // Creates new type out of the `Article` interface composed
277
+ // from the Articles' two properties: `title` and `thumbnail`.
278
+ // `ArticlePreview = {title: string; thumbnail: string}`
279
+ type ArticlePreview = Pick<Article, 'title' | 'thumbnail'>;
280
+
281
+ // Render a list of articles using only title and description.
282
+ function renderArticlePreviews(previews: ArticlePreview[]): HTMLElement {
283
+ const articles = document.createElement('div');
284
+
285
+ for (const preview of previews) {
286
+ // Append preview to the articles.
287
+ }
288
+
289
+ return articles;
290
+ }
291
+
292
+ const articles = renderArticlePreviews([
293
+ {
294
+ title: 'TypeScript tutorial!',
295
+ thumbnail: '/assets/ts.jpg'
296
+ }
297
+ ]);
298
+ ```
299
+ </details>
300
+
301
+ - [`Record<K, T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434) - Construct a type with a set of properties `K` of type `T`.
302
+ <details>
303
+ <summary>
304
+ Example
305
+ </summary>
306
+
307
+ [Playground](https://typescript-play.js.org/?target=6#code/AQ4ejYAUHsGcCWAXBMB2dgwGbAKYC2ADgDYwCeeemCaWArgE7ADGMxAhmuQHQBQoYEnJE8wALKEARnkaxEKdMAC8wAOS0kstGuAAfdQBM8ANzxlRjXQbVaWACwC0JPB0NqA3HwGgIwAJJoWozYHCxixnAsjAhStADmwESMMJYo1Fi4HMCIaPEu+MRklHj8gpqyoeHAAKJFFFTAAN4+giDYCIxwSAByHAR4AFw5SDF5Xm2gJBzdfQPD3WPxE5PAlBxdAPLYNQAelgh4aOHDaPQEMowrIAC+3oJ+AMKMrlrAXFhSAFZ4LEhC9g4-0BmA4JBISXgiCkBQABpILrJ5MhUGhYcATGD6Bk4Hh-jNgABrPDkOBlXyQAAq9ngYmJpOAAHcEOCRjAXqwYODfoo6DhakUSph+Uh7GI4P0xER4Cj0OSQGwMP8tP1hgAlX7swwAHgRl2RvIANALSA08ABtAC6AD4VM1Wm0Kow0MMrYaHYJjGYLLJXZb3at1HYnC43Go-QHQDcvA6-JsmEJXARgCDgMYWAhjIYhDAU+YiMAAFIwex0ZmilMITCGF79TLAGRsAgJYAAZRwSEZGzEABFTOZUrJ5Yn+jwnWgeER6HB7AAKJrADpdXqS4ZqYultTG6azVfqHswPBbtauLY7fayQ7HIbAAAMwBuAEoYw9IBq2Ixs9h2eFMOQYPQObALQKJgggABeYhghCIpikkKRpOQRIknAsZUiIeCttECBEP8NSMCkjDDAARMGziuIYxHwYOjDCMBmDNnAuTxA6irdCOBB1Lh5Dqpqn66tISIykawBnOCtqqC0gbjqc9DgpGkxegOliyfJDrRkAA)
308
+
309
+ ```ts
310
+ // Positions of employees in our company.
311
+ type MemberPosition = 'intern' | 'developer' | 'tech-lead';
312
+
313
+ // Interface describing properties of a single employee.
314
+ interface Employee {
315
+ firstName: string;
316
+ lastName: string;
317
+ yearsOfExperience: number;
318
+ }
319
+
320
+ // Create an object that has all possible `MemberPosition` values set as keys.
321
+ // Those keys will store a collection of Employees of the same position.
322
+ const team: Record<MemberPosition, Employee[]> = {
323
+ intern: [],
324
+ developer: [],
325
+ 'tech-lead': [],
326
+ };
327
+
328
+ // Our team has decided to help John with his dream of becoming Software Developer.
329
+ team.intern.push({
330
+ firstName: 'John',
331
+ lastName: 'Doe',
332
+ yearsOfExperience: 0
333
+ });
334
+
335
+ // `Record` forces you to initialize all of the property keys.
336
+ // TypeScript Error: "tech-lead" property is missing
337
+ const teamEmpty: Record<MemberPosition, null> = {
338
+ intern: null,
339
+ developer: null,
340
+ };
341
+ ```
342
+ </details>
343
+
344
+ - [`Exclude<T, U>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1436-L1439) - Exclude from `T` those types that are assignable to `U`.
345
+ <details>
346
+ <summary>
347
+ Example
348
+ </summary>
349
+
350
+ [Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgMrQG7QMIHsQzADmyA3gFDLIAOuUYAXMiAK4A2byAPsgM5hRQJHqwC2AI2gBucgF9y5MAE9qKAEoQAjiwj8AEnBAATNtGQBeZAAooWphu26wAGmS3e93bRC8IASgsAPmRDJRlyAHoI5ABRAA8ENhYjFFYOZGVVZBgoXFFkAAM0zh5+QRBhZhYJaAKAOkjogEkQZAQ4X2QAdwALCFbaemRgXmQtFjhOMFwq9K6ULuB0lk6U+HYwZAxJnQaYFhAEMGB8ZCIIMAAFOjAANR2IK0HGWISklIAedCgsKDwCYgAbQA5M9gQBdVzFQJ+JhiSRQMiUYYwayZCC4VHPCzmSzAspCYEBWxgFhQAZwKC+FpgJ43VwARgADH4ZFQSWSBjcZPJyPtDsdTvxKWBvr8rD1DCZoJ5HPopaYoK4EPhCEQmGKcKriLCtrhgEYkVQVT5Nr4fmZLLZtMBbFZgT0wGBqES6ghbHBIJqoBKFdBWQpjfh+DQbhY2tqiHVsbjLMVkAB+ZAAZiZaeQTHOVxu9ySjxNaujNwDVHNvzqbBGkBAdPoAfkQA)
351
+
352
+ ```ts
353
+ interface ServerConfig {
354
+ port: null | string | number;
355
+ }
356
+
357
+ type RequestHandler = (request: Request, response: Response) => void;
358
+
359
+ // Exclude `null` type from `null | string | number`.
360
+ // In case the port is equal to `null`, we will use default value.
361
+ function getPortValue(port: Exclude<ServerConfig['port'], null>): number {
362
+ if (typeof port === 'string') {
363
+ return parseInt(port, 10);
364
+ }
365
+
366
+ return port;
367
+ }
368
+
369
+ function startServer(handler: RequestHandler, config: ServerConfig): void {
370
+ const server = require('http').createServer(handler);
371
+
372
+ const port = config.port === null ? 3000 : getPortValue(config.port);
373
+ server.listen(port);
374
+ }
375
+ ```
376
+ </details>
377
+
378
+ - [`Extract<T, U>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1441-L1444) - Extract from `T` those types that are assignable to `U`.
379
+ <details>
380
+ <summary>
381
+ Example
382
+ </summary>
383
+
384
+ [Playground](https://typescript-play.js.org/?target=6#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzSwEdkQBJYACgEoAueVZAWwCMQYBuAKDDwGcM8MgBF4AXngBlAJ6scESgHIRi6ty5ZUGdoihgEABXZ888AN5d48ANoiAuvUat23K6ihMQ9ATE0BzV3goPy8GZjZOLgBfLi4Aejj4AEEICBwAdz54MAALKFQQ+BxEeAAHY1NgKAwoIKy0grr4DByEUpgccpgMaXgAaxBerCzi+B9-ZulygDouFHRsU1z8kKMYE1RhaqgAHkt4AHkWACt4EAAPbVRgLLWNgBp9gGlBs8uQa6yAUUuYPQwdgNpKM7nh7mMML4CgA+R5WABqUAgpDeVxuhxO1he0jsXGh8EoOBO9COx3BQPo2PBADckaR6IjkSA6PBqTgsMBzPsicdrEC7OJWXSQNwYvFEgAVTS9JLXODpeDpKBZFg4GCoWa8VACIJykAKiQWKy2YQOAioYikCg0OEMDyhRSy4DyxS24KhAAMjyi6gS8AAwjh5OD0iBFHAkJoEOksC1mnkMJq8gUQKDNttKPlnfrwYp3J5XfBHXqoKpfYkAOI4ansTxaeDADmoRSCCBYAbxhC6TDx6rwYHIRX5bScjA4bLJwoDmDwDkfbA9JMrVMVdM1TN69LgkTgwgkchUahqIA)
385
+
386
+ ```ts
387
+ declare function uniqueId(): number;
388
+
389
+ const ID = Symbol('ID');
390
+
391
+ interface Person {
392
+ [ID]: number;
393
+ name: string;
394
+ age: number;
395
+ }
396
+
397
+ // Allows changing the person data as long as the property key is of string type.
398
+ function changePersonData<
399
+ Obj extends Person,
400
+ Key extends Extract<keyof Person, string>,
401
+ Value extends Obj[Key]
402
+ > (obj: Obj, key: Key, value: Value): void {
403
+ obj[key] = value;
404
+ }
405
+
406
+ // Tiny Andrew was born.
407
+ const andrew = {
408
+ [ID]: uniqueId(),
409
+ name: 'Andrew',
410
+ age: 0,
411
+ };
412
+
413
+ // Cool, we're fine with that.
414
+ changePersonData(andrew, 'name', 'Pony');
415
+
416
+ // Goverment didn't like the fact that you wanted to change your identity.
417
+ changePersonData(andrew, ID, uniqueId());
418
+ ```
419
+ </details>
420
+
421
+ - [`NonNullable<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1446-L1449) - Exclude `null` and `undefined` from `T`.
422
+ <details>
423
+ <summary>
424
+ Example
425
+ </summary>
426
+ Works with <code>strictNullChecks</code> set to <code>true</code>. (Read more <a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html">here</a>)
427
+
428
+ [Playground](https://typescript-play.js.org/?target=6#code/C4TwDgpgBACg9gJ2AOQK4FsBGEFQLxQDOwCAlgHYDmUAPlORtrnQwDasDcAUFwPQBU-WAEMkUOADMowqAGNWwwoSgATCBIqlgpOOSjAAFsOBRSy1IQgr9cKJlSlW1mZYQA3HFH68u8xcoBlHA8EACEHJ08Aby4oKDBUTFZSWXjEFEYcAEIALihkXTR2YSSIAB54JDQsHAA+blj4xOTUsHSACkMzPKD3HHDHNQQAGjSkPMqMmoQASh7g-oihqBi4uNIpdraxPAI2VhmVxrX9AzMAOm2ppnwoAA4ABifuE4BfKAhWSyOTuK7CS7pao3AhXF5rV48E4ICDAVAIPT-cGQyG+XTEIgLMJLTx7CAAdygvRCA0iCHaMwarhJOIQjUBSHaACJHk8mYdeLwxtdcVAAOSsh58+lXdr7Dlcq7A3n3J4PEUdADMcspUE53OluAIUGVTx46oAKuAIAFZGQwCYAKIIBCILjUxaDHAMnla+iodjcIA)
429
+
430
+ ```ts
431
+ type PortNumber = string | number | null;
432
+
433
+ /** Part of a class definition that is used to build a server */
434
+ class ServerBuilder {
435
+ portNumber!: NonNullable<PortNumber>;
436
+
437
+ port(this: ServerBuilder, port: PortNumber): ServerBuilder {
438
+ if (port == null) {
439
+ this.portNumber = 8000;
440
+ } else {
441
+ this.portNumber = port;
442
+ }
443
+
444
+ return this;
445
+ }
446
+ }
447
+
448
+ const serverBuilder = new ServerBuilder();
449
+
450
+ serverBuilder
451
+ .port('8000') // portNumber = '8000'
452
+ .port(null) // portNumber = 8000
453
+ .port(3000); // portNumber = 3000
454
+
455
+ // TypeScript error
456
+ serverBuilder.portNumber = null;
457
+ ```
458
+ </details>
459
+
460
+ - [`Parameters<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1451-L1454) - Obtain the parameters of a function type in a tuple.
461
+ <details>
462
+ <summary>
463
+ Example
464
+ </summary>
465
+
466
+ [Playground](https://typescript-play.js.org/?target=6#code/GYVwdgxgLglg9mABAZwBYmMANgUwBQxgAOIUAXIgIZgCeA2gLoCUFAbnDACaIDeAUIkQB6IYgCypSlBxUATrMo1ECsJzgBbLEoipqAc0J7EMKMgDkiHLnU4wp46pwAPHMgB0fAL58+oSLARECEosLAA5ABUYG2QAHgAxJGdpVWREPDdMylk9ZApqemZEAF4APipacrw-CApEgBogkKwAYThwckQwEHUAIxxZJl4BYVEImiIZKF0oZRwiWVdbeygJmThgOYgcGFYcbhqApCJsyhtpWXcR1cnEePBoeDAABVPzgbTixFeFd8uEsClADcIxGiygIFkSEOT3SmTc2VydQeRx+ZxwF2QQ34gkEwDgsnSuFmMBKiAADEDjIhYk1Qm0OlSYABqZnYka4xA1DJZHJYkGc7yCbyeRA+CAIZCzNAYbA4CIAdxg2zJwVCkWirjwMswuEaACYmCCgA)
467
+
468
+ ```ts
469
+ function shuffle(input: any[]): void {
470
+ // Mutate array randomly changing its' elements indexes.
471
+ }
472
+
473
+ function callNTimes<Fn extends (...args: any[]) => any> (func: Fn, callCount: number) {
474
+ // Type that represents the type of the received function parameters.
475
+ type FunctionParameters = Parameters<Fn>;
476
+
477
+ return function (...args: FunctionParameters) {
478
+ for (let i = 0; i < callCount; i++) {
479
+ func(...args);
480
+ }
481
+ }
482
+ }
483
+
484
+ const shuffleTwice = callNTimes(shuffle, 2);
485
+ ```
486
+ </details>
487
+
488
+ - [`ConstructorParameters<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1456-L1459) - Obtain the parameters of a constructor function type in a tuple.
489
+ <details>
490
+ <summary>
491
+ Example
492
+ </summary>
493
+
494
+ [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECCBOAXAlqApgWQPYBM0mgG8AoaaFRENALmgkXmQDsBzAblOmCycTV4D8teo1YdO3JiICuwRFngAKClWENmLAJRFOZRAAtkEAHQq00ALzlklNBzIBfYk+KhIMAJJTEYJsDQAwmDA+mgAPAAq0GgAHnxMODCKTGgA7tCKxllg8CwQtL4AngDaALraFgB80EWa1SRkAA6MAG5gfNAB4FABPDJyCrQR9tDNyG0dwMGhtBhgjWEiGgA00F70vv4RhY3hEZXVVinpc42KmuJkkv3y8Bly8EPaDWTkhiZd7r3e8LK3llwGCMXGQWGhEOsfH5zJlsrl8p0+gw-goAAo5MAAW3BaHgEEilU0tEhmzQ212BJ0ry4SOg+kg+gBBiMximIGA0nAfAQLGk2N4EAAEgzYcYcnkLsRdDTvNEYkYUKwSdCme9WdM0MYwYhFPSIPpJdTkAAzDKxBUaZX+aAAQgsVmkCTQxuYaBw2ng4Ok8CYcotSu8pMur09iG9vuObxZnx6SN+AyUWTF8MN0CcZE4Ywm5jZHK5aB5fP4iCFIqT4oRRTKRLo6lYVNeAHpG50wOzOe1zHr9NLQ+HoABybsD4HOKXXRA1JCoKhBELmI5pNaB6Fz0KKBAodDYPAgSUTmqYsAALx4m5nC6nW9nGq14KtaEUA9gR9PvuNCjQ9BgACNvcwNBtAcLiAA)
495
+
496
+ ```ts
497
+ class ArticleModel {
498
+ title: string;
499
+ content?: string;
500
+
501
+ constructor(title: string) {
502
+ this.title = title;
503
+ }
504
+ }
505
+
506
+ class InstanceCache<T extends (new (...args: any[]) => any)> {
507
+ private ClassConstructor: T;
508
+ private cache: Map<string, InstanceType<T>> = new Map();
509
+
510
+ constructor (ctr: T) {
511
+ this.ClassConstructor = ctr;
512
+ }
513
+
514
+ getInstance (...args: ConstructorParameters<T>): InstanceType<T> {
515
+ const hash = this.calculateArgumentsHash(...args);
516
+
517
+ const existingInstance = this.cache.get(hash);
518
+ if (existingInstance !== undefined) {
519
+ return existingInstance;
520
+ }
521
+
522
+ return new this.ClassConstructor(...args);
523
+ }
524
+
525
+ private calculateArgumentsHash(...args: any[]): string {
526
+ // Calculate hash.
527
+ return 'hash';
528
+ }
529
+ }
530
+
531
+ const articleCache = new InstanceCache(ArticleModel);
532
+ const amazonArticle = articleCache.getInstance('Amazon forests burining!');
533
+ ```
534
+ </details>
535
+
536
+ - [`ReturnType<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1461-L1464) – Obtain the return type of a function type.
537
+ <details>
538
+ <summary>
539
+ Example
540
+ </summary>
541
+
542
+ [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)
543
+
544
+ ```ts
545
+ /** Provides every element of the iterable `iter` into the `callback` function and stores the results in an array. */
546
+ function mapIter<
547
+ Elem,
548
+ Func extends (elem: Elem) => any,
549
+ Ret extends ReturnType<Func>
550
+ >(iter: Iterable<Elem>, callback: Func): Ret[] {
551
+ const mapped: Ret[] = [];
552
+
553
+ for (const elem of iter) {
554
+ mapped.push(callback(elem));
555
+ }
556
+
557
+ return mapped;
558
+ }
559
+
560
+ const setObject: Set<string> = new Set();
561
+ const mapObject: Map<number, string> = new Map();
562
+
563
+ mapIter(setObject, (value: string) => value.indexOf('Foo')); // number[]
564
+
565
+ mapIter(mapObject, ([key, value]: [number, string]) => {
566
+ return key % 2 === 0 ? value : 'Odd';
567
+ }); // string[]
568
+ ```
569
+ </details>
570
+
571
+ - [`InstanceType<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1466-L1469) – Obtain the instance type of a constructor function type.
572
+ <details>
573
+ <summary>
574
+ Example
575
+ </summary>
576
+
577
+ [Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)
578
+
579
+ ```ts
580
+ class IdleService {
581
+ doNothing (): void {}
582
+ }
583
+
584
+ class News {
585
+ title: string;
586
+ content: string;
587
+
588
+ constructor(title: string, content: string) {
589
+ this.title = title;
590
+ this.content = content;
591
+ }
592
+ }
593
+
594
+ const instanceCounter: Map<Function, number> = new Map();
595
+
596
+ interface Constructor {
597
+ new(...args: any[]): any;
598
+ }
599
+
600
+ // Keep track how many instances of `Constr` constructor have been created.
601
+ function getInstance<
602
+ Constr extends Constructor,
603
+ Args extends ConstructorParameters<Constr>
604
+ >(constructor: Constr, ...args: Args): InstanceType<Constr> {
605
+ let count = instanceCounter.get(constructor) || 0;
606
+
607
+ const instance = new constructor(...args);
608
+
609
+ instanceCounter.set(constructor, count + 1);
610
+
611
+ console.log(`Created ${count + 1} instances of ${Constr.name} class`);
612
+
613
+ return instance;
614
+ }
615
+
616
+
617
+ const idleService = getInstance(IdleService);
618
+ // Will log: `Created 1 instances of IdleService class`
619
+ const newsEntry = getInstance(News, 'New ECMAScript proposals!', 'Last month...');
620
+ // Will log: `Created 1 instances of News class`
621
+ ```
622
+ </details>
623
+
624
+ - [`Omit<T, K>`](https://github.com/microsoft/TypeScript/blob/71af02f7459dc812e85ac31365bfe23daf14b4e4/src/lib/es5.d.ts#L1446) – Constructs a type by picking all properties from T and then removing K.
625
+ <details>
626
+ <summary>
627
+ Example
628
+ </summary>
629
+
630
+ [Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgIImAWzgG2QbwChlks4BzCAVShwC5kBnMKUcgbmKYAcIFgIjBs1YgOXMpSFMWbANoBdTiW5woFddwAW0kfKWEAvoUIB6U8gDCUCHEiNkICAHdkYAJ69kz4GC3JcPG4oAHteKDABBxCYNAxsPFBIWEQUCAAPJG4wZABySUFcgJAAEzMLXNV1ck0dIuCw6EjBADpy5AB1FAQ4EGQAV0YUP2AHDy8wEOQbUugmBLwtEIA3OcmQnEjuZBgQqE7gAGtgZAhwKHdkHFGwNvGUdDIcAGUliIBJEF3kAF5kAHlML4ADyPBIAGjyBUYRQAPnkqho4NoYQA+TiEGD9EAISIhPozErQMG4AASK2gn2+AApek9pCSXm8wFSQooAJQMUkAFQAsgAZACiOAgmDOOSIJAQ+OYyGl4DgoDmf2QJRCCH6YvALQQNjsEGFovF1NyJWAy1y7OUyHMyE+yRAuFImG4Iq1YDswHxbRINjA-SgfXlHqVUE4xiAA)
631
+
632
+ ```ts
633
+ interface Animal {
634
+ imageUrl: string;
635
+ species: string;
636
+ images: string[];
637
+ paragraphs: string[];
638
+ }
639
+
640
+ // Creates new type with all properties of the `Animal` interface
641
+ // except 'images' and 'paragraphs' properties. We can use this
642
+ // type to render small hover tooltip for a wiki entry list.
643
+ type AnimalShortInfo = Omit<Animal, 'images' | 'paragraphs'>;
644
+
645
+ function renderAnimalHoverInfo (animals: AnimalShortInfo[]): HTMLElement {
646
+ const container = document.createElement('div');
647
+ // Internal implementation.
648
+ return container;
649
+ }
650
+ ```
651
+ </details>
652
+
653
+ - [`Uppercase<S extends string>`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#template-literal-types) - Transforms every character in a string into uppercase.
654
+ <details>
655
+ <summary>
656
+ Example
657
+ </summary>
658
+
659
+ ```ts
660
+ type T = Uppercase<'hello'>; // 'HELLO'
661
+
662
+ type T2 = Uppercase<'foo' | 'bar'>; // 'FOO' | 'BAR'
663
+
664
+ type T3<S extends string> = Uppercase<`aB${S}`>;
665
+ type T4 = T30<'xYz'>; // 'ABXYZ'
666
+
667
+ type T5 = Uppercase<string>; // string
668
+ type T6 = Uppercase<any>; // any
669
+ type T7 = Uppercase<never>; // never
670
+ type T8 = Uppercase<42>; // Error, type 'number' does not satisfy the constraint 'string'
671
+ ```
672
+ </details>
673
+
674
+ - [`Lowercase<S extends string>`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#template-literal-types) - Transforms every character in a string into lowercase.
675
+ <details>
676
+ <summary>
677
+ Example
678
+ </summary>
679
+
680
+ ```ts
681
+ type T = Lowercase<'HELLO'>; // 'hello'
682
+
683
+ type T2 = Lowercase<'FOO' | 'BAR'>; // 'foo' | 'bar'
684
+
685
+ type T3<S extends string> = Lowercase<`aB${S}`>;
686
+ type T4 = T32<'xYz'>; // 'abxyz'
687
+
688
+ type T5 = Lowercase<string>; // string
689
+ type T6 = Lowercase<any>; // any
690
+ type T7 = Lowercase<never>; // never
691
+ type T8 = Lowercase<42>; // Error, type 'number' does not satisfy the constraint 'string'
692
+ ```
693
+ </details>
694
+
695
+ - [`Capitalize<S extends string>`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#template-literal-types) - Transforms the first character in a string into uppercase.
696
+ <details>
697
+ <summary>
698
+ Example
699
+ </summary>
700
+
701
+ ```ts
702
+ type T = Capitalize<'hello'>; // 'Hello'
703
+
704
+ type T2 = Capitalize<'foo' | 'bar'>; // 'Foo' | 'Bar'
705
+
706
+ type T3<S extends string> = Capitalize<`aB${S}`>;
707
+ type T4 = T32<'xYz'>; // 'ABxYz'
708
+
709
+ type T5 = Capitalize<string>; // string
710
+ type T6 = Capitalize<any>; // any
711
+ type T7 = Capitalize<never>; // never
712
+ type T8 = Capitalize<42>; // Error, type 'number' does not satisfy the constraint 'string'
713
+ ```
714
+ </details>
715
+
716
+ - [`Uncapitalize<S extends string>`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#template-literal-types) - Transforms the first character in a string into lowercase.
717
+ <details>
718
+ <summary>
719
+ Example
720
+ </summary>
721
+
722
+ ```ts
723
+ type T = Uncapitalize<'Hello'>; // 'hello'
724
+
725
+ type T2 = Uncapitalize<'Foo' | 'Bar'>; // 'foo' | 'bar'
726
+
727
+ type T3<S extends string> = Uncapitalize<`AB${S}`>;
728
+ type T4 = T30<'xYz'>; // 'aBxYz'
729
+
730
+ type T5 = Uncapitalize<string>; // string
731
+ type T6 = Uncapitalize<any>; // any
732
+ type T7 = Uncapitalize<never>; // never
733
+ type T8 = Uncapitalize<42>; // Error, type 'number' does not satisfy the constraint 'string'
734
+ ```
735
+ </details>
736
+
737
+ You can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/advanced-types.html#predefined-conditional-types).
738
+
739
+ ## Maintainers
740
+
741
+ - [Sindre Sorhus](https://github.com/sindresorhus)
742
+ - [Jarek Radosz](https://github.com/CvX)
743
+ - [Dimitri Benin](https://github.com/BendingBender)
744
+ - [Pelle Wessman](https://github.com/voxpelli)
745
+
746
+ ## License
747
+
748
+ (MIT OR CC0-1.0)
749
+
750
+ ---
751
+
752
+ <div align="center">
753
+ <b>
754
+ <a href="https://tidelift.com/subscription/pkg/npm-type-fest?utm_source=npm-type-fest&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
755
+ </b>
756
+ <br>
757
+ <sub>
758
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
759
+ </sub>
760
+ </div>