@quantiya/codevibe-claude-plugin 2.0.26 → 2.0.27

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 (299) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/node_modules/@quantiya/codevibe-core/dist/__tests__/terminal-menu.test.d.ts +1 -0
  3. package/node_modules/@quantiya/codevibe-core/dist/index.d.ts +2 -0
  4. package/node_modules/@quantiya/codevibe-core/dist/index.js +321 -317
  5. package/node_modules/@quantiya/codevibe-core/dist/prompt-parser.d.ts +3 -1
  6. package/node_modules/@quantiya/codevibe-core/dist/terminal-menu.d.ts +22 -0
  7. package/node_modules/@quantiya/codevibe-core/package.json +1 -1
  8. package/node_modules/es-toolkit/CHANGELOG.md +38 -3
  9. package/node_modules/es-toolkit/dist/browser.global.js +4 -4
  10. package/node_modules/es-toolkit/dist/compat/array/differenceWith.js +2 -1
  11. package/node_modules/es-toolkit/dist/compat/array/differenceWith.mjs +2 -1
  12. package/node_modules/es-toolkit/dist/compat/array/findLastIndex.js +5 -3
  13. package/node_modules/es-toolkit/dist/compat/array/findLastIndex.mjs +5 -3
  14. package/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.js +1 -1
  15. package/node_modules/es-toolkit/dist/compat/array/sortedIndexBy.mjs +1 -1
  16. package/node_modules/es-toolkit/dist/compat/array/without.js +8 -2
  17. package/node_modules/es-toolkit/dist/compat/array/without.mjs +8 -2
  18. package/node_modules/es-toolkit/dist/compat/array/xorWith.js +4 -6
  19. package/node_modules/es-toolkit/dist/compat/array/xorWith.mjs +4 -6
  20. package/node_modules/es-toolkit/dist/compat/compat.js +1 -1
  21. package/node_modules/es-toolkit/dist/compat/compat.mjs +1 -1
  22. package/node_modules/es-toolkit/dist/compat/function/debounce.js +1 -1
  23. package/node_modules/es-toolkit/dist/compat/function/debounce.mjs +1 -1
  24. package/node_modules/es-toolkit/dist/compat/index.js +1 -1
  25. package/node_modules/es-toolkit/dist/compat/index.mjs +1 -1
  26. package/node_modules/es-toolkit/dist/compat/object/has.js +3 -2
  27. package/node_modules/es-toolkit/dist/compat/object/has.mjs +3 -2
  28. package/node_modules/es-toolkit/dist/compat/object/hasIn.js +3 -2
  29. package/node_modules/es-toolkit/dist/compat/object/hasIn.mjs +3 -2
  30. package/node_modules/es-toolkit/dist/compat/object/mergeWith.js +1 -1
  31. package/node_modules/es-toolkit/dist/compat/object/mergeWith.mjs +1 -1
  32. package/node_modules/es-toolkit/dist/compat/object/omitBy.js +1 -1
  33. package/node_modules/es-toolkit/dist/compat/object/omitBy.mjs +1 -1
  34. package/node_modules/es-toolkit/dist/compat/object/pickBy.js +1 -1
  35. package/node_modules/es-toolkit/dist/compat/object/pickBy.mjs +1 -1
  36. package/node_modules/es-toolkit/dist/compat/util/toString.js +3 -1
  37. package/node_modules/es-toolkit/dist/compat/util/toString.mjs +3 -1
  38. package/node_modules/es-toolkit/dist/fp/flowAsync.d.mts +213 -0
  39. package/node_modules/es-toolkit/dist/fp/flowAsync.d.ts +213 -0
  40. package/node_modules/es-toolkit/dist/fp/flowAsync.js +37 -0
  41. package/node_modules/es-toolkit/dist/fp/flowAsync.mjs +37 -0
  42. package/node_modules/es-toolkit/dist/fp/index.d.mts +2 -1
  43. package/node_modules/es-toolkit/dist/fp/index.d.ts +2 -1
  44. package/node_modules/es-toolkit/dist/fp/index.js +2 -0
  45. package/node_modules/es-toolkit/dist/fp/index.mjs +2 -1
  46. package/node_modules/es-toolkit/dist/fp/iterator/cartesianProduct.d.mts +23 -0
  47. package/node_modules/es-toolkit/dist/fp/iterator/cartesianProduct.d.ts +23 -0
  48. package/node_modules/es-toolkit/dist/fp/iterator/cartesianProduct.js +28 -0
  49. package/node_modules/es-toolkit/dist/fp/iterator/cartesianProduct.mjs +28 -0
  50. package/node_modules/es-toolkit/dist/fp/iterator/chunk.d.mts +19 -0
  51. package/node_modules/es-toolkit/dist/fp/iterator/chunk.d.ts +19 -0
  52. package/node_modules/es-toolkit/dist/fp/iterator/chunk.js +24 -0
  53. package/node_modules/es-toolkit/dist/fp/iterator/chunk.mjs +24 -0
  54. package/node_modules/es-toolkit/dist/fp/iterator/count.d.mts +20 -0
  55. package/node_modules/es-toolkit/dist/fp/iterator/count.d.ts +20 -0
  56. package/node_modules/es-toolkit/dist/fp/iterator/count.js +25 -0
  57. package/node_modules/es-toolkit/dist/fp/iterator/count.mjs +25 -0
  58. package/node_modules/es-toolkit/dist/fp/iterator/drop.d.mts +20 -0
  59. package/node_modules/es-toolkit/dist/fp/iterator/drop.d.ts +20 -0
  60. package/node_modules/es-toolkit/dist/fp/iterator/drop.js +24 -0
  61. package/node_modules/es-toolkit/dist/fp/iterator/drop.mjs +24 -0
  62. package/node_modules/es-toolkit/dist/fp/iterator/dropWhile.d.mts +18 -0
  63. package/node_modules/es-toolkit/dist/fp/iterator/dropWhile.d.ts +18 -0
  64. package/node_modules/es-toolkit/dist/fp/iterator/dropWhile.js +23 -0
  65. package/node_modules/es-toolkit/dist/fp/iterator/dropWhile.mjs +23 -0
  66. package/node_modules/es-toolkit/dist/fp/iterator/every.d.mts +20 -0
  67. package/node_modules/es-toolkit/dist/fp/iterator/every.d.ts +20 -0
  68. package/node_modules/es-toolkit/dist/fp/iterator/every.js +24 -0
  69. package/node_modules/es-toolkit/dist/fp/iterator/every.mjs +24 -0
  70. package/node_modules/es-toolkit/dist/fp/iterator/filter.d.mts +37 -0
  71. package/node_modules/es-toolkit/dist/fp/iterator/filter.d.ts +37 -0
  72. package/node_modules/es-toolkit/dist/fp/iterator/filter.js +8 -0
  73. package/node_modules/es-toolkit/dist/fp/iterator/filter.mjs +8 -0
  74. package/node_modules/es-toolkit/dist/fp/iterator/find.d.mts +20 -0
  75. package/node_modules/es-toolkit/dist/fp/iterator/find.d.ts +20 -0
  76. package/node_modules/es-toolkit/dist/fp/iterator/find.js +24 -0
  77. package/node_modules/es-toolkit/dist/fp/iterator/find.mjs +24 -0
  78. package/node_modules/es-toolkit/dist/fp/iterator/flatMap.d.mts +20 -0
  79. package/node_modules/es-toolkit/dist/fp/iterator/flatMap.d.ts +20 -0
  80. package/node_modules/es-toolkit/dist/fp/iterator/flatMap.js +24 -0
  81. package/node_modules/es-toolkit/dist/fp/iterator/flatMap.mjs +24 -0
  82. package/node_modules/es-toolkit/dist/fp/iterator/forEach.d.mts +22 -0
  83. package/node_modules/es-toolkit/dist/fp/iterator/forEach.d.ts +22 -0
  84. package/node_modules/es-toolkit/dist/fp/iterator/forEach.js +26 -0
  85. package/node_modules/es-toolkit/dist/fp/iterator/forEach.mjs +26 -0
  86. package/node_modules/es-toolkit/dist/fp/iterator/head.d.mts +19 -0
  87. package/node_modules/es-toolkit/dist/fp/iterator/head.d.ts +19 -0
  88. package/node_modules/es-toolkit/dist/fp/iterator/head.js +24 -0
  89. package/node_modules/es-toolkit/dist/fp/iterator/head.mjs +24 -0
  90. package/node_modules/es-toolkit/dist/fp/iterator/index.d.mts +22 -0
  91. package/node_modules/es-toolkit/dist/fp/iterator/index.d.ts +22 -0
  92. package/node_modules/es-toolkit/dist/fp/iterator/index.js +43 -0
  93. package/node_modules/es-toolkit/dist/fp/iterator/index.mjs +22 -0
  94. package/node_modules/es-toolkit/dist/fp/iterator/map.d.mts +20 -0
  95. package/node_modules/es-toolkit/dist/fp/iterator/map.d.ts +20 -0
  96. package/node_modules/es-toolkit/dist/fp/iterator/map.js +24 -0
  97. package/node_modules/es-toolkit/dist/fp/iterator/map.mjs +24 -0
  98. package/node_modules/es-toolkit/dist/fp/iterator/partition.d.mts +22 -0
  99. package/node_modules/es-toolkit/dist/fp/iterator/partition.d.ts +22 -0
  100. package/node_modules/es-toolkit/dist/fp/iterator/partition.js +27 -0
  101. package/node_modules/es-toolkit/dist/fp/iterator/partition.mjs +27 -0
  102. package/node_modules/es-toolkit/dist/fp/iterator/reduce.d.mts +24 -0
  103. package/node_modules/es-toolkit/dist/fp/iterator/reduce.d.ts +24 -0
  104. package/node_modules/es-toolkit/dist/fp/iterator/reduce.js +28 -0
  105. package/node_modules/es-toolkit/dist/fp/iterator/reduce.mjs +28 -0
  106. package/node_modules/es-toolkit/dist/fp/iterator/scan.d.mts +21 -0
  107. package/node_modules/es-toolkit/dist/fp/iterator/scan.d.ts +21 -0
  108. package/node_modules/es-toolkit/dist/fp/iterator/scan.js +26 -0
  109. package/node_modules/es-toolkit/dist/fp/iterator/scan.mjs +26 -0
  110. package/node_modules/es-toolkit/dist/fp/iterator/some.d.mts +20 -0
  111. package/node_modules/es-toolkit/dist/fp/iterator/some.d.ts +20 -0
  112. package/node_modules/es-toolkit/dist/fp/iterator/some.js +24 -0
  113. package/node_modules/es-toolkit/dist/fp/iterator/some.mjs +24 -0
  114. package/node_modules/es-toolkit/dist/fp/iterator/take.d.mts +21 -0
  115. package/node_modules/es-toolkit/dist/fp/iterator/take.d.ts +21 -0
  116. package/node_modules/es-toolkit/dist/fp/iterator/take.js +25 -0
  117. package/node_modules/es-toolkit/dist/fp/iterator/take.mjs +25 -0
  118. package/node_modules/es-toolkit/dist/fp/iterator/takeWhile.d.mts +19 -0
  119. package/node_modules/es-toolkit/dist/fp/iterator/takeWhile.d.ts +19 -0
  120. package/node_modules/es-toolkit/dist/fp/iterator/takeWhile.js +24 -0
  121. package/node_modules/es-toolkit/dist/fp/iterator/takeWhile.mjs +24 -0
  122. package/node_modules/es-toolkit/dist/fp/iterator/toArray.d.mts +21 -0
  123. package/node_modules/es-toolkit/dist/fp/iterator/toArray.d.ts +21 -0
  124. package/node_modules/es-toolkit/dist/fp/iterator/toArray.js +25 -0
  125. package/node_modules/es-toolkit/dist/fp/iterator/toArray.mjs +25 -0
  126. package/node_modules/es-toolkit/dist/fp/iterator/uniqBy.d.mts +20 -0
  127. package/node_modules/es-toolkit/dist/fp/iterator/uniqBy.d.ts +20 -0
  128. package/node_modules/es-toolkit/dist/fp/iterator/uniqBy.js +25 -0
  129. package/node_modules/es-toolkit/dist/fp/iterator/uniqBy.mjs +25 -0
  130. package/node_modules/es-toolkit/dist/fp/iterator/zip.d.mts +20 -0
  131. package/node_modules/es-toolkit/dist/fp/iterator/zip.d.ts +20 -0
  132. package/node_modules/es-toolkit/dist/fp/iterator/zip.js +25 -0
  133. package/node_modules/es-toolkit/dist/fp/iterator/zip.mjs +25 -0
  134. package/node_modules/es-toolkit/dist/index.d.mts +3 -1
  135. package/node_modules/es-toolkit/dist/index.d.ts +3 -1
  136. package/node_modules/es-toolkit/dist/index.js +4 -0
  137. package/node_modules/es-toolkit/dist/index.mjs +3 -1
  138. package/node_modules/es-toolkit/dist/iterator/_internal/iterator.js +74 -0
  139. package/node_modules/es-toolkit/dist/iterator/_internal/iterator.mjs +74 -0
  140. package/node_modules/es-toolkit/dist/iterator/cartesianProduct.d.mts +33 -0
  141. package/node_modules/es-toolkit/dist/iterator/cartesianProduct.d.ts +33 -0
  142. package/node_modules/es-toolkit/dist/iterator/cartesianProduct.js +95 -0
  143. package/node_modules/es-toolkit/dist/iterator/cartesianProduct.mjs +95 -0
  144. package/node_modules/es-toolkit/dist/iterator/chunk.d.mts +21 -0
  145. package/node_modules/es-toolkit/dist/iterator/chunk.d.ts +21 -0
  146. package/node_modules/es-toolkit/dist/iterator/chunk.js +40 -0
  147. package/node_modules/es-toolkit/dist/iterator/chunk.mjs +40 -0
  148. package/node_modules/es-toolkit/dist/iterator/count.d.mts +18 -0
  149. package/node_modules/es-toolkit/dist/iterator/count.d.ts +18 -0
  150. package/node_modules/es-toolkit/dist/iterator/count.js +26 -0
  151. package/node_modules/es-toolkit/dist/iterator/count.mjs +26 -0
  152. package/node_modules/es-toolkit/dist/iterator/dropWhile.d.mts +20 -0
  153. package/node_modules/es-toolkit/dist/iterator/dropWhile.d.ts +20 -0
  154. package/node_modules/es-toolkit/dist/iterator/dropWhile.js +52 -0
  155. package/node_modules/es-toolkit/dist/iterator/dropWhile.mjs +52 -0
  156. package/node_modules/es-toolkit/dist/iterator/head.d.mts +21 -0
  157. package/node_modules/es-toolkit/dist/iterator/head.d.ts +21 -0
  158. package/node_modules/es-toolkit/dist/iterator/head.js +26 -0
  159. package/node_modules/es-toolkit/dist/iterator/head.mjs +26 -0
  160. package/node_modules/es-toolkit/dist/iterator/index.d.mts +13 -0
  161. package/node_modules/es-toolkit/dist/iterator/index.d.ts +13 -0
  162. package/node_modules/es-toolkit/dist/iterator/index.js +25 -0
  163. package/node_modules/es-toolkit/dist/iterator/index.mjs +13 -0
  164. package/node_modules/es-toolkit/dist/iterator/iterate.d.mts +20 -0
  165. package/node_modules/es-toolkit/dist/iterator/iterate.d.ts +20 -0
  166. package/node_modules/es-toolkit/dist/iterator/iterate.js +32 -0
  167. package/node_modules/es-toolkit/dist/iterator/iterate.mjs +32 -0
  168. package/node_modules/es-toolkit/dist/iterator/partition.d.mts +18 -0
  169. package/node_modules/es-toolkit/dist/iterator/partition.d.ts +18 -0
  170. package/node_modules/es-toolkit/dist/iterator/partition.js +36 -0
  171. package/node_modules/es-toolkit/dist/iterator/partition.mjs +36 -0
  172. package/node_modules/es-toolkit/dist/iterator/range.d.mts +42 -0
  173. package/node_modules/es-toolkit/dist/iterator/range.d.ts +42 -0
  174. package/node_modules/es-toolkit/dist/iterator/range.js +25 -0
  175. package/node_modules/es-toolkit/dist/iterator/range.mjs +25 -0
  176. package/node_modules/es-toolkit/dist/iterator/scan.d.mts +23 -0
  177. package/node_modules/es-toolkit/dist/iterator/scan.d.ts +23 -0
  178. package/node_modules/es-toolkit/dist/iterator/scan.js +47 -0
  179. package/node_modules/es-toolkit/dist/iterator/scan.mjs +47 -0
  180. package/node_modules/es-toolkit/dist/iterator/takeWhile.d.mts +20 -0
  181. package/node_modules/es-toolkit/dist/iterator/takeWhile.d.ts +20 -0
  182. package/node_modules/es-toolkit/dist/iterator/takeWhile.js +34 -0
  183. package/node_modules/es-toolkit/dist/iterator/takeWhile.mjs +34 -0
  184. package/node_modules/es-toolkit/dist/iterator/uniqBy.d.mts +22 -0
  185. package/node_modules/es-toolkit/dist/iterator/uniqBy.d.ts +22 -0
  186. package/node_modules/es-toolkit/dist/iterator/uniqBy.js +43 -0
  187. package/node_modules/es-toolkit/dist/iterator/uniqBy.mjs +43 -0
  188. package/node_modules/es-toolkit/dist/iterator/zip.d.mts +23 -0
  189. package/node_modules/es-toolkit/dist/iterator/zip.d.ts +23 -0
  190. package/node_modules/es-toolkit/dist/iterator/zip.js +45 -0
  191. package/node_modules/es-toolkit/dist/iterator/zip.mjs +45 -0
  192. package/node_modules/es-toolkit/dist/object/merge.d.mts +3 -1
  193. package/node_modules/es-toolkit/dist/object/merge.d.ts +3 -1
  194. package/node_modules/es-toolkit/dist/object/merge.js +0 -40
  195. package/node_modules/es-toolkit/dist/object/merge.mjs +0 -40
  196. package/node_modules/es-toolkit/dist/object/omitBy.d.mts +4 -2
  197. package/node_modules/es-toolkit/dist/object/omitBy.d.ts +4 -2
  198. package/node_modules/es-toolkit/dist/object/omitBy.js +4 -3
  199. package/node_modules/es-toolkit/dist/object/omitBy.mjs +4 -3
  200. package/node_modules/es-toolkit/dist/object/pickBy.d.mts +4 -2
  201. package/node_modules/es-toolkit/dist/object/pickBy.d.ts +4 -2
  202. package/node_modules/es-toolkit/dist/object/pickBy.js +4 -3
  203. package/node_modules/es-toolkit/dist/object/pickBy.mjs +4 -3
  204. package/node_modules/es-toolkit/dist/types/EmptyObject.d.mts +21 -0
  205. package/node_modules/es-toolkit/dist/types/EmptyObject.d.ts +21 -0
  206. package/node_modules/es-toolkit/dist/types/IsEqual.d.mts +18 -0
  207. package/node_modules/es-toolkit/dist/types/IsEqual.d.ts +18 -0
  208. package/node_modules/es-toolkit/dist/types/JSONValue.d.mts +24 -0
  209. package/node_modules/es-toolkit/dist/types/JSONValue.d.ts +24 -0
  210. package/node_modules/es-toolkit/dist/types/Merge.d.mts +37 -0
  211. package/node_modules/es-toolkit/dist/types/Merge.d.ts +37 -0
  212. package/node_modules/es-toolkit/dist/types/ObjectKeys.d.mts +19 -0
  213. package/node_modules/es-toolkit/dist/types/ObjectKeys.d.ts +19 -0
  214. package/node_modules/es-toolkit/dist/types/Primitive.d.mts +14 -0
  215. package/node_modules/es-toolkit/dist/types/Primitive.d.ts +14 -0
  216. package/node_modules/es-toolkit/dist/types/SetOptional.d.mts +20 -0
  217. package/node_modules/es-toolkit/dist/types/SetOptional.d.ts +20 -0
  218. package/node_modules/es-toolkit/dist/types/SetRequired.d.mts +20 -0
  219. package/node_modules/es-toolkit/dist/types/SetRequired.d.ts +20 -0
  220. package/node_modules/es-toolkit/dist/types/UnknownRecord.d.mts +24 -0
  221. package/node_modules/es-toolkit/dist/types/UnknownRecord.d.ts +24 -0
  222. package/node_modules/es-toolkit/dist/types/index.d.mts +11 -2
  223. package/node_modules/es-toolkit/dist/types/index.d.ts +11 -2
  224. package/node_modules/es-toolkit/dist/util/attempt.d.mts +1 -1
  225. package/node_modules/es-toolkit/dist/util/attempt.d.ts +1 -1
  226. package/node_modules/es-toolkit/dist/util/attemptAsync.d.mts +1 -1
  227. package/node_modules/es-toolkit/dist/util/attemptAsync.d.ts +1 -1
  228. package/node_modules/es-toolkit/dist/util/defer.d.mts +27 -0
  229. package/node_modules/es-toolkit/dist/util/defer.d.ts +27 -0
  230. package/node_modules/es-toolkit/dist/util/defer.js +31 -0
  231. package/node_modules/es-toolkit/dist/util/defer.mjs +31 -0
  232. package/node_modules/es-toolkit/dist/util/deferAsync.d.mts +30 -0
  233. package/node_modules/es-toolkit/dist/util/deferAsync.d.ts +30 -0
  234. package/node_modules/es-toolkit/dist/util/deferAsync.js +34 -0
  235. package/node_modules/es-toolkit/dist/util/deferAsync.mjs +34 -0
  236. package/node_modules/es-toolkit/dist/util/index.d.mts +3 -1
  237. package/node_modules/es-toolkit/dist/util/index.d.ts +3 -1
  238. package/node_modules/es-toolkit/dist/util/index.js +4 -0
  239. package/node_modules/es-toolkit/dist/util/index.mjs +3 -1
  240. package/node_modules/es-toolkit/fp/iterator.d.ts +1 -0
  241. package/node_modules/es-toolkit/fp/iterator.js +1 -0
  242. package/node_modules/es-toolkit/iterator.d.ts +1 -0
  243. package/node_modules/es-toolkit/iterator.js +1 -0
  244. package/node_modules/es-toolkit/package.json +44 -1
  245. package/node_modules/node-abi/abi_registry.json +7 -0
  246. package/node_modules/node-abi/package.json +1 -1
  247. package/node_modules/qs/.github/THREAT_MODEL.md +3 -3
  248. package/node_modules/qs/CHANGELOG.md +15 -0
  249. package/node_modules/qs/README.md +19 -1
  250. package/node_modules/qs/dist/qs.js +21 -21
  251. package/node_modules/qs/eslint.config.mjs +1 -1
  252. package/node_modules/qs/lib/parse.js +3 -4
  253. package/node_modules/qs/lib/stringify.js +23 -8
  254. package/node_modules/qs/lib/utils.js +10 -3
  255. package/node_modules/qs/package.json +4 -4
  256. package/node_modules/qs/test/parse.js +192 -3
  257. package/node_modules/qs/test/stringify.js +317 -0
  258. package/node_modules/qs/test/utils.js +12 -0
  259. package/node_modules/type-fest/index.d.ts +6 -7
  260. package/node_modules/type-fest/package.json +1 -1
  261. package/node_modules/type-fest/readme.md +6 -5
  262. package/node_modules/type-fest/source/delimiter-case.d.ts +1 -1
  263. package/node_modules/type-fest/source/get.d.ts +1 -1
  264. package/node_modules/type-fest/source/internal/object.d.ts +30 -1
  265. package/node_modules/type-fest/source/is-boolean-literal.d.ts +39 -0
  266. package/node_modules/type-fest/source/is-literal.d.ts +43 -269
  267. package/node_modules/type-fest/source/is-numeric-literal.d.ts +50 -0
  268. package/node_modules/type-fest/source/is-string-literal.d.ts +72 -0
  269. package/node_modules/type-fest/source/is-symbol-literal.d.ts +39 -0
  270. package/node_modules/type-fest/source/jsonify.d.ts +1 -5
  271. package/node_modules/type-fest/source/remove-prefix.d.ts +1 -1
  272. package/node_modules/type-fest/source/remove-suffix.d.ts +1 -1
  273. package/node_modules/type-fest/source/rename-keys.d.ts +163 -0
  274. package/node_modules/type-fest/source/shared-union-fields-deep.d.ts +4 -3
  275. package/node_modules/type-fest/source/split.d.ts +1 -1
  276. package/node_modules/type-fest/source/string-repeat.d.ts +1 -1
  277. package/node_modules/type-fest/source/string-to-array.d.ts +1 -1
  278. package/node_modules/type-fest/source/tsconfig-json.d.ts +1 -1
  279. package/node_modules/type-fest/source/typed-array.d.ts +1 -0
  280. package/node_modules/type-fest/source/writable.d.ts +2 -2
  281. package/package.json +2 -2
  282. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/LICENSE.md +0 -0
  283. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/README.md +0 -0
  284. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/common.gypi +0 -0
  285. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/except.gypi +0 -0
  286. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/index.js +0 -0
  287. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/napi-inl.deprecated.h +0 -0
  288. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/napi-inl.h +0 -0
  289. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/napi.h +0 -0
  290. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/node_api.gyp +0 -0
  291. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/noexcept.gypi +0 -0
  292. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/nothing.c +0 -0
  293. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/package-support.json +0 -0
  294. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/package.json +0 -0
  295. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/tools/README.md +0 -0
  296. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/tools/check-napi.js +0 -0
  297. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/tools/clang-format.js +0 -0
  298. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/tools/conversion.js +0 -0
  299. /package/node_modules/{node-addon-api → keytar/node_modules/node-addon-api}/tools/eslint-format.js +0 -0
@@ -1,272 +1,14 @@
1
- import type {Primitive} from './primitive.d.ts';
2
- import type {_Numeric} from './numeric.d.ts';
3
- import type {CollapseLiterals, IfNotAnyOrNever, IsNotFalse, IsPrimitive} from './internal/index.d.ts';
1
+ import type {IsStringLiteral} from './is-string-literal.d.ts';
2
+ import type {IsNumericLiteral} from './is-numeric-literal.d.ts';
3
+ import type {IsBooleanLiteral} from './is-boolean-literal.d.ts';
4
+ import type {IsSymbolLiteral} from './is-symbol-literal.d.ts';
4
5
  import type {IsNever} from './is-never.d.ts';
5
- import type {TagContainer, UnwrapTagged} from './tagged.d.ts';
6
-
7
- /**
8
- Returns a boolean for whether the given type `T` is the specified `LiteralType`.
9
-
10
- @link https://stackoverflow.com/a/52806744/10292952
11
-
12
- @example
13
- ```
14
- type A = LiteralCheck<1, number>;
15
- //=> true
16
-
17
- type B = LiteralCheck<number, number>;
18
- //=> false
19
-
20
- type C = LiteralCheck<1, string>;
21
- //=> false
22
- ```
23
- */
24
- type LiteralCheck<T, LiteralType extends Primitive> = (
25
- IsNever<T> extends false // Must be wider than `never`
26
- ? [T] extends [LiteralType & infer U] // Remove any branding
27
- ? [U] extends [LiteralType] // Must be narrower than `LiteralType`
28
- ? [LiteralType] extends [U] // Cannot be wider than `LiteralType`
29
- ? false
30
- : true
31
- : false
32
- : false
33
- : false
34
- );
35
-
36
- /**
37
- Returns a boolean for whether the given type `T` is one of the specified literal types in `LiteralUnionType`.
38
-
39
- @example
40
- ```
41
- type A = LiteralChecks<1, Numeric>;
42
- //=> true
43
-
44
- type B = LiteralChecks<1n, Numeric>;
45
- //=> true
46
-
47
- type C = LiteralChecks<bigint, Numeric>;
48
- //=> false
49
- ```
50
- */
51
- type LiteralChecks<T, LiteralUnionType> = (
52
- // Conditional type to force union distribution.
53
- // If `T` is none of the literal types in the union `LiteralUnionType`, then `LiteralCheck<T, LiteralType>` will evaluate to `false` for the whole union.
54
- // If `T` is one of the literal types in the union, it will evaluate to `boolean` (i.e. `true | false`)
55
- IsNotFalse<LiteralUnionType extends Primitive
56
- ? LiteralCheck<T, LiteralUnionType>
57
- : never
58
- >
59
- );
60
-
61
- /**
62
- Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
63
-
64
- Useful for:
65
- - providing strongly-typed string manipulation functions
66
- - constraining strings to be a string literal
67
- - type utilities, such as when constructing parsers and ASTs
68
-
69
- The implementation of this type is inspired by the trick mentioned in this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
70
-
71
- @example
72
- ```
73
- import type {IsStringLiteral} from 'type-fest';
74
-
75
- type CapitalizedString<T extends string> = IsStringLiteral<T> extends true ? Capitalize<T> : string;
76
-
77
- // https://github.com/yankeeinlondon/native-dash/blob/master/src/capitalize.ts
78
- function capitalize<T extends Readonly<string>>(input: T): CapitalizedString<T> {
79
- return (input.slice(0, 1).toUpperCase() + input.slice(1)) as CapitalizedString<T>;
80
- }
81
-
82
- const output = capitalize('hello, world!');
83
- //=> 'Hello, world!'
84
- ```
85
-
86
- @example
87
- ```
88
- // String types with infinite set of possible values return `false`.
89
-
90
- import type {IsStringLiteral} from 'type-fest';
91
-
92
- type AllUppercaseStrings = IsStringLiteral<Uppercase<string>>;
93
- //=> false
94
-
95
- type StringsStartingWithOn = IsStringLiteral<`on${string}`>;
96
- //=> false
97
-
98
- // This behaviour is particularly useful in string manipulation utilities, as infinite string types often require separate handling.
99
-
100
- type Length<S extends string, Counter extends never[] = []> =
101
- IsStringLiteral<S> extends false
102
- ? number // return `number` for infinite string types
103
- : S extends `${string}${infer Tail}`
104
- ? Length<Tail, [...Counter, never]>
105
- : Counter['length'];
106
-
107
- type L1 = Length<Lowercase<string>>;
108
- //=> number
109
-
110
- type L2 = Length<`${number}`>;
111
- //=> number
112
- ```
113
-
114
- @category Type Guard
115
- @category Utilities
116
- */
117
- export type IsStringLiteral<S> = IfNotAnyOrNever<S, {
118
- ifNot: _IsStringLiteral<CollapseLiterals<S extends TagContainer<any> ? UnwrapTagged<S> : S>>;
119
- ifAny: false;
120
- ifNever: false;
121
- }>;
122
-
123
- export type _IsStringLiteral<S> =
124
- // If `T` is an infinite string type (e.g., `on${string}`), `Record<T, never>` produces an index signature,
125
- // and since `{}` extends index signatures, the result becomes `false`.
126
- S extends string
127
- ? {} extends Record<S, never>
128
- ? false
129
- : true
130
- : false;
131
-
132
- /**
133
- Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
134
-
135
- Useful for:
136
- - providing strongly-typed functions when given literal arguments
137
- - type utilities, such as when constructing parsers and ASTs
138
-
139
- @example
140
- ```
141
- import type {IsNumericLiteral, IsStringLiteral} from 'type-fest';
142
-
143
- // https://github.com/inocan-group/inferred-types/blob/master/modules/types/src/boolean-logic/operators/EndsWith.ts
144
- type EndsWith<TValue, TEndsWith extends string> =
145
- TValue extends string
146
- ? IsStringLiteral<TEndsWith> extends true
147
- ? IsStringLiteral<TValue> extends true
148
- ? TValue extends `${string}${TEndsWith}`
149
- ? true
150
- : false
151
- : boolean
152
- : boolean
153
- : TValue extends number
154
- ? IsNumericLiteral<TValue> extends true
155
- ? EndsWith<`${TValue}`, TEndsWith>
156
- : false
157
- : false;
158
-
159
- function endsWith<Input extends string | number, End extends string>(input: Input, end: End) {
160
- return `${input}`.endsWith(end) as EndsWith<Input, End>;
161
- }
162
-
163
- endsWith('abc', 'c');
164
- //=> true
165
-
166
- endsWith(123_456, '456');
167
- //=> true
168
-
169
- const end = '123' as string;
170
-
171
- endsWith('abc123', end);
172
- //=> boolean
173
- ```
174
-
175
- @category Type Guard
176
- @category Utilities
177
- */
178
- export type IsNumericLiteral<T> = LiteralChecks<T, _Numeric>;
179
-
180
- /**
181
- Returns a boolean for whether the given type is a `true` or `false` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
182
-
183
- Useful for:
184
- - providing strongly-typed functions when given literal arguments
185
- - type utilities, such as when constructing parsers and ASTs
186
-
187
- @example
188
- ```
189
- import type {IsBooleanLiteral} from 'type-fest';
190
-
191
- const id = 123;
192
-
193
- type GetId<AsString extends boolean> =
194
- IsBooleanLiteral<AsString> extends true
195
- ? AsString extends true
196
- ? `${typeof id}`
197
- : typeof id
198
- : number | string;
199
-
200
- function getId<AsString extends boolean = false>(options?: {asString: AsString}) {
201
- return (options?.asString ? `${id}` : id) as GetId<AsString>;
202
- }
203
-
204
- const numberId = getId();
205
- //=> 123
206
-
207
- const stringId = getId({asString: true});
208
- //=> '123'
209
-
210
- declare const runtimeBoolean: boolean;
211
- const eitherId = getId({asString: runtimeBoolean});
212
- //=> string | number
213
- ```
214
-
215
- @category Type Guard
216
- @category Utilities
217
- */
218
- export type IsBooleanLiteral<T> = LiteralCheck<T, boolean>;
219
-
220
- /**
221
- Returns a boolean for whether the given type is a `symbol` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
222
-
223
- Useful for:
224
- - providing strongly-typed functions when given literal arguments
225
- - type utilities, such as when constructing parsers and ASTs
226
-
227
- @example
228
- ```
229
- import type {IsSymbolLiteral} from 'type-fest';
230
-
231
- type Get<Object_ extends Record<symbol, number>, Key extends keyof Object_> =
232
- IsSymbolLiteral<Key> extends true
233
- ? Object_[Key]
234
- : number;
235
-
236
- function get<Object_ extends Record<symbol, number>, Key extends keyof Object_>(o: Object_, key: Key) {
237
- return o[key] as Get<Object_, Key>;
238
- }
239
-
240
- const symbolLiteral = Symbol('literal');
241
- let symbolValue = Symbol('value1');
242
- symbolValue = Symbol('value2');
243
-
244
- get({[symbolLiteral]: 1} as const, symbolLiteral);
245
- //=> 1
246
-
247
- get({[symbolValue]: 1} as const, symbolValue);
248
- //=> number
249
- ```
250
-
251
- @category Type Guard
252
- @category Utilities
253
- */
254
- export type IsSymbolLiteral<T> = LiteralCheck<T, symbol>;
255
-
256
- /** Helper type for `IsLiteral`. */
257
- type IsLiteralUnion<T> =
258
- | IsStringLiteral<T>
259
- | IsNumericLiteral<T>
260
- | IsBooleanLiteral<T>
261
- | IsSymbolLiteral<T>;
6
+ import type {IfNotAnyOrNever} from './internal/type.d.ts';
7
+ import type {CollapseLiterals, UnwrapBrand} from './internal/object.d.ts';
262
8
 
263
9
  /**
264
10
  Returns a boolean for whether the given type is a [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
265
11
 
266
- Useful for:
267
- - providing strongly-typed functions when given literal arguments
268
- - type utilities, such as when constructing parsers and ASTs
269
-
270
12
  @example
271
13
  ```
272
14
  import type {IsLiteral} from 'type-fest';
@@ -302,16 +44,48 @@ type I = IsLiteral<symbol>;
302
44
  type J = IsLiteral<true>;
303
45
  //=> true
304
46
 
305
- type K = IsLiteral<boolean>;
47
+ type K = IsLiteral<false>;
48
+ //=> true
49
+
50
+ type L = IsLiteral<boolean>;
306
51
  //=> false
52
+
53
+ type M = IsLiteral<1 | 'foo' | false>;
54
+ //=> true
55
+
56
+ type N = IsLiteral<string | number | symbol>;
57
+ //=> false
58
+
59
+ type O = IsLiteral<1000n | string | true>;
60
+ //=> boolean
307
61
  ```
308
62
 
309
63
  @category Type Guard
310
64
  @category Utilities
311
65
  */
312
- export type IsLiteral<T> =
313
- IsPrimitive<T> extends true
314
- ? IsNotFalse<IsLiteralUnion<T>>
315
- : false;
66
+ export type IsLiteral<T> = IfNotAnyOrNever<T, {
67
+ ifNot: _IsLiteral<CollapseLiterals<UnwrapBrand<T>>>;
68
+ ifAny: false;
69
+ ifNever: false;
70
+ }>;
71
+
72
+ type _IsLiteral<T> =
73
+ | (Extract<T, boolean> extends infer Bools
74
+ // We can't instantiate `IsBooleanLiteral` with `never`,
75
+ // because that will add an extraneous `false` to the result if there are no booleans.
76
+ ? IsNever<Bools> extends true
77
+ ? never
78
+ : IsBooleanLiteral<Bools>
79
+ : never)
80
+ | (IsLiteralNonBools<Exclude<T, boolean>>);
81
+
82
+ type IsLiteralNonBools<T> =
83
+ T extends number | bigint
84
+ ? IsNumericLiteral<T>
85
+ : T extends string
86
+ ? IsStringLiteral<T>
87
+ : T extends symbol
88
+ ? IsSymbolLiteral<T>
89
+ : false;
316
90
 
317
91
  export {};
@@ -0,0 +1,50 @@
1
+ import type {CollapseLiterals, UnwrapBrand} from './internal/object.d.ts';
2
+ import type {IfNotAnyOrNever} from './internal/type.d.ts';
3
+
4
+ /**
5
+ Returns a boolean for whether the given type is a `number` or `bigint` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
6
+
7
+ @example
8
+ ```
9
+ import type {IsNumericLiteral} from 'type-fest';
10
+
11
+ type A = IsNumericLiteral<0>;
12
+ //=> true
13
+
14
+ type B = IsNumericLiteral<number>;
15
+ //=> false
16
+
17
+ type C = IsNumericLiteral<100n>;
18
+ //=> true
19
+
20
+ type D = IsNumericLiteral<bigint>;
21
+ //=> false
22
+
23
+ type E = IsNumericLiteral<1 | 2 | 10n | 20n>;
24
+ //=> true
25
+
26
+ type F = IsNumericLiteral<number | bigint>;
27
+ //=> false
28
+
29
+ type G = IsNumericLiteral<1 | bigint>;
30
+ //=> boolean
31
+ ```
32
+
33
+ @category Type Guard
34
+ @category Utilities
35
+ */
36
+ export type IsNumericLiteral<T> = IfNotAnyOrNever<T, {
37
+ ifNot: _IsNumericLiteral<CollapseLiterals<UnwrapBrand<T>>>;
38
+ ifAny: false;
39
+ ifNever: false;
40
+ }>;
41
+
42
+ type _IsNumericLiteral<T> = T extends number | bigint
43
+ ? number extends T
44
+ ? false
45
+ : bigint extends T
46
+ ? false
47
+ : true
48
+ : false;
49
+
50
+ export {};
@@ -0,0 +1,72 @@
1
+ import type {CollapseLiterals, UnwrapBrand} from './internal/object.d.ts';
2
+ import type {IfNotAnyOrNever} from './internal/type.d.ts';
3
+
4
+ /**
5
+ Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
6
+
7
+ The implementation of this type is inspired by the trick mentioned in this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
8
+
9
+ @example
10
+ ```
11
+ import type {IsStringLiteral} from 'type-fest';
12
+
13
+ type A = IsStringLiteral<'foo'>;
14
+ //=> true
15
+
16
+ type B = IsStringLiteral<string>;
17
+ //=> false
18
+
19
+ // String types with infinite set of possible values return `false`
20
+ type C = IsStringLiteral<`on${string}`>;
21
+ //=> false
22
+
23
+ type D = IsStringLiteral<Uppercase<string>>;
24
+ //=> false
25
+
26
+ type E = IsStringLiteral<'foo' | 'bar' | 'baz'>;
27
+ //=> true
28
+
29
+ type F = IsStringLiteral<'sm' | 'md' | 'lg' | `${number}px`>;
30
+ //=> boolean
31
+ ```
32
+
33
+ @example
34
+ ```
35
+ import type {IsStringLiteral} from 'type-fest';
36
+
37
+ type StringLength<S extends string, Counter extends never[] = []> =
38
+ IsStringLiteral<S> extends true
39
+ ? S extends `${string}${infer Tail}`
40
+ ? StringLength<Tail, [...Counter, never]>
41
+ : Counter['length']
42
+ : number; // return `number` for non-literal string types
43
+
44
+ type L1 = StringLength<'foobar'>;
45
+ //=> 6
46
+
47
+ type L2 = StringLength<Lowercase<string>>;
48
+ //=> number
49
+
50
+ type L3 = StringLength<`${number}`>;
51
+ //=> number
52
+ ```
53
+
54
+ @category Type Guard
55
+ @category Utilities
56
+ */
57
+ export type IsStringLiteral<S> = IfNotAnyOrNever<S, {
58
+ ifNot: _IsStringLiteral<CollapseLiterals<UnwrapBrand<S>>>;
59
+ ifAny: false;
60
+ ifNever: false;
61
+ }>;
62
+
63
+ type _IsStringLiteral<S> =
64
+ // If `S` is an infinite string type (e.g., `on${string}`), `Record<S, never>` produces an index signature,
65
+ // and since `{}` extends index signatures, the result becomes `false`.
66
+ S extends string
67
+ ? {} extends Record<S, never>
68
+ ? false
69
+ : true
70
+ : false;
71
+
72
+ export {};
@@ -0,0 +1,39 @@
1
+ import type {CollapseLiterals, UnwrapBrand} from './internal/object.d.ts';
2
+ import type {IfNotAnyOrNever} from './internal/type.d.ts';
3
+
4
+ /**
5
+ Returns a boolean for whether the given type is a `symbol` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types).
6
+
7
+ @example
8
+ ```
9
+ import type {IsSymbolLiteral} from 'type-fest';
10
+
11
+ declare const symbolLiteral1: unique symbol;
12
+ declare const symbolLiteral2: unique symbol;
13
+
14
+ type A = IsSymbolLiteral<typeof symbolLiteral1>;
15
+ //=> true
16
+
17
+ type B = IsSymbolLiteral<symbol>;
18
+ //=> false
19
+
20
+ type C = IsSymbolLiteral<typeof symbolLiteral1 | typeof symbolLiteral2>;
21
+ //=> true
22
+ ```
23
+
24
+ @category Type Guard
25
+ @category Utilities
26
+ */
27
+ export type IsSymbolLiteral<T> = IfNotAnyOrNever<T, {
28
+ ifNot: _IsSymbolLiteral<CollapseLiterals<UnwrapBrand<T>>>;
29
+ ifAny: false;
30
+ ifNever: false;
31
+ }>;
32
+
33
+ type _IsSymbolLiteral<T> = T extends symbol
34
+ ? symbol extends T
35
+ ? false
36
+ : true
37
+ : false;
38
+
39
+ export {};
@@ -25,15 +25,11 @@ type JsonifyList<T extends UnknownArray> = T extends readonly []
25
25
  ? JsonValue[]
26
26
  : Array<T[number] extends NotJsonable ? null : Jsonify<UndefinedToNull<T[number]>>>;
27
27
 
28
- type FilterJsonableKeys<T extends object> = {
29
- [Key in keyof T]: T[Key] extends NotJsonable ? never : Key;
30
- }[keyof T];
31
-
32
28
  /**
33
29
  JSON serialize objects (not including arrays) and classes.
34
30
  */
35
31
  type JsonifyObject<T extends object> = {
36
- [Key in keyof Pick<T, FilterJsonableKeys<T>>]: Jsonify<T[Key]>;
32
+ [Key in keyof T as T[Key] extends NotJsonable ? never : Key]: Jsonify<T[Key]>;
37
33
  };
38
34
 
39
35
  /**
@@ -1,6 +1,6 @@
1
1
  import type {ApplyDefaultOptions} from './internal/object.d.ts';
2
2
  import type {IfNotAnyOrNever, Not} from './internal/type.d.ts';
3
- import type {IsStringLiteral} from './is-literal.d.ts';
3
+ import type {IsStringLiteral} from './is-string-literal.d.ts';
4
4
  import type {IsNever} from './is-never.d.ts';
5
5
  import type {Or} from './or.d.ts';
6
6
  import type {If} from './if.d.ts';
@@ -1,6 +1,6 @@
1
1
  import type {ApplyDefaultOptions} from './internal/object.d.ts';
2
2
  import type {IfNotAnyOrNever, Not} from './internal/type.d.ts';
3
- import type {IsStringLiteral} from './is-literal.d.ts';
3
+ import type {IsStringLiteral} from './is-string-literal.d.ts';
4
4
  import type {IsNever} from './is-never.d.ts';
5
5
  import type {Or} from './or.d.ts';
6
6
  import type {If} from './if.d.ts';
@@ -0,0 +1,163 @@
1
+ import type {IsLiteral} from './is-literal.d.ts';
2
+ import type {ReadonlyKeysOf} from './readonly-keys-of.d.ts';
3
+ import type {RequiredKeysOf} from './required-keys-of.d.ts';
4
+ import type {OptionalKeysOf} from './optional-keys-of.d.ts';
5
+ import type {OmitIndexSignature} from './omit-index-signature.d.ts';
6
+ import type {SetRequired} from './set-required.d.ts';
7
+ import type {SetReadonly} from './set-readonly.d.ts';
8
+ import type {IfNotAnyOrNever, IsExactOptionalPropertyTypesEnabled} from './internal/type.d.ts';
9
+
10
+ /**
11
+ Rename keys in an object type according to a map of old-to-new names.
12
+
13
+ @example
14
+ ```
15
+ import type {RenameKeys} from 'type-fest';
16
+
17
+ type User = {
18
+ id: string;
19
+ firstName: string;
20
+ createdAt: Date;
21
+ };
22
+
23
+ type Renamed = RenameKeys<User, {firstName: 'first_name'; createdAt: 'created_at'}>;
24
+ //=> {id: string; first_name: string; created_at: Date}
25
+ ```
26
+
27
+ @example
28
+ ```
29
+ import type {RenameKeys} from 'type-fest';
30
+
31
+ type SearchInput = {
32
+ textQuery: string;
33
+ voiceQuery: Blob;
34
+ imageQuery: File;
35
+ };
36
+
37
+ type Normalized = RenameKeys<SearchInput, {textQuery: 'query'; voiceQuery: 'query'; imageQuery: 'query'}>;
38
+ //=> {query: string | Blob | File}
39
+ ```
40
+
41
+ Note: When multiple source keys map to the same target, the target's value type is the union of the contributors' value types. The target is optional only when every contributor is optional, and is `readonly` when any contributor is `readonly`. With `exactOptionalPropertyTypes` disabled, the value type of a mixed-optionality merge also includes `undefined`.
42
+
43
+ @example
44
+ ```
45
+ import type {RenameKeys} from 'type-fest';
46
+
47
+ // All colliding keys are required, so the target is required.
48
+ type A = RenameKeys<{a: 1; b: 2}, {a: 'x'; b: 'x'}>;
49
+ //=> {x: 1 | 2}
50
+
51
+ // All colliding keys are optional, so the target is optional.
52
+ type B = RenameKeys<{a?: 1; b?: 2}, {a: 'x'; b: 'x'}>;
53
+ //=> {x?: 1 | 2}
54
+
55
+ // One of the colliding keys is required, so the target is required.
56
+ type C = RenameKeys<{a: 1; b?: 2}, {a: 'x'; b: 'x'}>;
57
+ //=> {x: 1 | 2}
58
+
59
+ // One of the colliding keys is `readonly`, so the target is `readonly`.
60
+ type D = RenameKeys<{readonly a: 1; b: 2}, {a: 'x'; b: 'x'}>;
61
+ //=> {readonly x: 1 | 2}
62
+ ```
63
+
64
+ @example
65
+ ```
66
+ // @exactOptionalPropertyTypes: false
67
+ import type {RenameKeys} from 'type-fest';
68
+
69
+ // With `exactOptionalPropertyTypes` disabled, a mixed-optionality merge includes `undefined`.
70
+ type E = RenameKeys<{a?: 1; b: 2}, {a: 'x'; b: 'x'}>;
71
+ //=> {x: 1 | 2 | undefined}
72
+ ```
73
+
74
+ Note: A union target distributes, producing one output key per member.
75
+
76
+ @example
77
+ ```
78
+ import type {RenameKeys} from 'type-fest';
79
+
80
+ type A = RenameKeys<{a: string}, {a: 'b' | 'c'}>;
81
+ //=> {b: string; c: string}
82
+ ```
83
+
84
+ Note: An entry whose value is not a literal `PropertyKey` (such as `string`) is also ignored, leaving that key's name unchanged.
85
+
86
+ @example
87
+ ```
88
+ import type {RenameKeys} from 'type-fest';
89
+
90
+ type A = RenameKeys<{a: 1}, {a: string}>;
91
+ //=> {a: 1}
92
+
93
+ type B = RenameKeys<{a: 1; b: 2}, {a: 'x'; b: symbol}>;
94
+ //=> {x: 1; b: 2}
95
+ ```
96
+
97
+ Note: A rename map entry whose key is not a property of the source type is ignored.
98
+
99
+ @example
100
+ ```
101
+ import type {RenameKeys} from 'type-fest';
102
+
103
+ type A = RenameKeys<{a: 1; b: 2}, {a: 'x'; c: 'y'}>;
104
+ //=> {x: 1; b: 2}
105
+ ```
106
+
107
+ @category Object
108
+ */
109
+ export type RenameKeys<
110
+ BaseType extends object,
111
+ RenameMap extends Record<PropertyKey, PropertyKey>,
112
+ > = IfNotAnyOrNever<BaseType, {
113
+ ifNot: BaseType extends unknown // For distributing `BaseType`
114
+ ? RenameMap extends unknown // For distributing `RenameMap`
115
+ ? RenameOnce<BaseType, NormalizeMap<RenameMap>>
116
+ : never
117
+ : never;
118
+ }>;
119
+
120
+ type RenameOnce<BaseType extends object, RenameMap extends Record<PropertyKey, PropertyKey>> =
121
+ RestoreMergedUndefined<BaseType, RenameMap,
122
+ ApplyReadonly<BaseType, RenameMap,
123
+ ApplyRequired<BaseType, RenameMap,
124
+ RenameNaive<BaseType, RenameMap>>>>;
125
+
126
+ type RenameNaive<BaseType extends object, RenameMap extends Record<PropertyKey, PropertyKey>> = {
127
+ // Two keys mapping to one target produce a union value and keep only the first key's modifiers.
128
+ // Like for example, `{a?: 1; b: 2}` with `{a: 'x'; b: 'x'}` produces `{x?: 1 | 2}`, taking `a`'s optional.
129
+ [Key in keyof BaseType as TargetOf<Key, RenameMap>]: Required<BaseType>[Key];
130
+ };
131
+
132
+ // A merged target kept only one modifier in `RenameNaive`, so re-force these from every contributor.
133
+ type ApplyRequired<BaseType extends object, RenameMap extends Record<PropertyKey, PropertyKey>, Renamed> =
134
+ SetRequired<Renamed, TargetOf<RequiredKeysOf<OmitIndexSignature<BaseType>>, RenameMap> & keyof Renamed>;
135
+
136
+ type ApplyReadonly<BaseType extends object, RenameMap extends Record<PropertyKey, PropertyKey>, Renamed> =
137
+ SetReadonly<Renamed, TargetOf<ReadonlyKeysOf<OmitIndexSignature<BaseType>>, RenameMap> & keyof Renamed>;
138
+
139
+ // `exactOptionalPropertyTypes` off keeps `undefined` on a target that merged a required and an optional source.
140
+ // Source `{a?: 1; x: 2}` with `{a: 'x'}` gives `{x: 1 | 2 | undefined}`.
141
+ type RestoreMergedUndefined<BaseType extends object, RenameMap extends Record<PropertyKey, PropertyKey>, Result> =
142
+ IsExactOptionalPropertyTypesEnabled extends true
143
+ ? Result
144
+ : {
145
+ [Key in keyof Result]: Key extends MergedTargets<BaseType, RenameMap>
146
+ ? Result[Key] | undefined
147
+ : Result[Key];
148
+ };
149
+
150
+ type MergedTargets<BaseType extends object, RenameMap extends Record<PropertyKey, PropertyKey>> =
151
+ // Targets renamed from both a required and an optional key prefer the required modifier.
152
+ // Required `b` and optional `a` both rename to `x` in `{a?: 1; b: 2}` with `{a: 'x'; b: 'x'}`.
153
+ TargetOf<RequiredKeysOf<OmitIndexSignature<BaseType>>, RenameMap>
154
+ & TargetOf<OptionalKeysOf<OmitIndexSignature<BaseType>>, RenameMap>;
155
+
156
+ type NormalizeMap<RenameMap extends Record<PropertyKey, PropertyKey>> = {
157
+ -readonly [Key in keyof RenameMap as true extends IsLiteral<RenameMap[Key]> ? Key : never]-?: RenameMap[Key];
158
+ };
159
+
160
+ type TargetOf<SourceKey extends PropertyKey, RenameMap extends Record<PropertyKey, PropertyKey>> =
161
+ SourceKey extends keyof RenameMap ? RenameMap[SourceKey] : SourceKey;
162
+
163
+ export {};