typenative 0.4.1 → 0.6.0

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 (270) hide show
  1. package/.github/workflows/ci.yml +2 -2
  2. package/.github/workflows/npm-publish-github-packages.yml +2 -2
  3. package/CHANGELOG.md +442 -1
  4. package/CONTRIBUTION.md +2 -1
  5. package/README.md +73 -25
  6. package/bin/cli.js +2 -0
  7. package/bin/index.js +75 -5
  8. package/bin/main.js +2 -0
  9. package/bin/node/assert.js +2 -2
  10. package/bin/node/async_hooks.js +1 -1
  11. package/bin/node/buffer.js +16 -5
  12. package/bin/node/child_process.js +7 -7
  13. package/bin/node/cluster.js +3 -3
  14. package/bin/node/core.js +41 -0
  15. package/bin/node/crypto_keys.js +21 -21
  16. package/bin/node/dgram.js +1 -1
  17. package/bin/node/diagnostics_channel.js +3 -3
  18. package/bin/node/dns.js +2 -2
  19. package/bin/node/events.js +18 -13
  20. package/bin/node/fetch.js +2 -2
  21. package/bin/node/fs.js +3 -3
  22. package/bin/node/fs_watch.js +5 -5
  23. package/bin/node/http.js +3 -3
  24. package/bin/node/http2.js +3 -3
  25. package/bin/node/net.js +8 -8
  26. package/bin/node/path.js +17 -3
  27. package/bin/node/process.js +47 -11
  28. package/bin/node/punycode.js +2 -2
  29. package/bin/node/readline.js +1 -1
  30. package/bin/node/registry.js +4 -1
  31. package/bin/node/sqlite.js +6 -6
  32. package/bin/node/stream.js +81 -15
  33. package/bin/node/stream_web.js +10 -10
  34. package/bin/node/system_extra.js +3 -3
  35. package/bin/node/test.js +674 -366
  36. package/bin/node/test_coverage.js +187 -0
  37. package/bin/node/test_report.js +1392 -0
  38. package/bin/node/test_run.js +575 -0
  39. package/bin/node/timers.js +8 -6
  40. package/bin/node/tls.js +5 -5
  41. package/bin/node/url.js +1 -1
  42. package/bin/node/util.js +31 -7
  43. package/bin/node/util_extra.js +7 -7
  44. package/bin/node/webview.js +654 -0
  45. package/bin/node/worker_threads.js +1 -1
  46. package/bin/node/zlib.js +3 -3
  47. package/bin/parse-node.js +6 -2
  48. package/bin/regex_vm.js +2057 -0
  49. package/bin/transpiler.js +32872 -11265
  50. package/bin/typecheck-node.js +2 -1
  51. package/bin/version.js +1 -1
  52. package/conformance.md +515 -345
  53. package/examples/README.md +71 -11
  54. package/examples/angular-templates/README.md +139 -0
  55. package/examples/angular-templates/bench.mjs +173 -0
  56. package/examples/angular-templates/dom-type-globals.d.ts +21 -0
  57. package/examples/angular-templates/dom-type-stubs.ts +21 -0
  58. package/examples/angular-templates/main.ts +135 -0
  59. package/examples/angular-templates/parity.mjs +157 -0
  60. package/examples/angular-templates/run-node.mjs +69 -0
  61. package/examples/angular-templates/vendor/angular/compiler/LICENSE +21 -0
  62. package/examples/desktop-notes/README.md +106 -0
  63. package/examples/desktop-notes/bench.mjs +125 -0
  64. package/examples/desktop-notes/main.ts +131 -0
  65. package/examples/desktop-notes/package-lock.json +726 -0
  66. package/examples/desktop-notes/package.json +9 -0
  67. package/examples/desktop-notes/ui.ts +176 -0
  68. package/examples/dupe-finder/README.md +78 -0
  69. package/examples/dupe-finder/bench.mjs +120 -0
  70. package/examples/dupe-finder/main.ts +87 -0
  71. package/examples/fibonacci/README.md +7 -7
  72. package/examples/hello-world/README.md +6 -6
  73. package/examples/json-server/README.md +19 -18
  74. package/examples/mandelbrot-png/README.md +63 -0
  75. package/examples/mandelbrot-png/bench.mjs +95 -0
  76. package/examples/mandelbrot-png/main.ts +98 -0
  77. package/examples/mandelbrot-png/preview.png +0 -0
  78. package/examples/marked-cli/README.md +160 -0
  79. package/examples/marked-cli/bench.mjs +178 -0
  80. package/examples/marked-cli/main.ts +292 -0
  81. package/examples/marked-cli/parity.mjs +185 -0
  82. package/examples/marked-cli/vendor/marked/LICENSE +44 -0
  83. package/examples/marked-cli/vendor/marked/VENDOR.md +26 -0
  84. package/examples/openai-chat/README.md +148 -0
  85. package/examples/openai-chat/bench.mjs +175 -0
  86. package/examples/openai-chat/main.ts +488 -0
  87. package/examples/react-compiler/README.md +170 -0
  88. package/examples/react-compiler/bench.mjs +181 -0
  89. package/examples/react-compiler/main.ts +158 -0
  90. package/examples/react-compiler/parity.mjs +362 -0
  91. package/examples/react-compiler/run-node.mjs +88 -0
  92. package/examples/react-compiler/vendor/babel/LICENSE +22 -0
  93. package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-lower.json +15 -0
  94. package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-upper.json +51 -0
  95. package/examples/react-compiler/vendor/charcodes/package.json +25 -0
  96. package/examples/react-compiler/vendor/invariant/LICENSE +21 -0
  97. package/examples/react-compiler/vendor/invariant/invariant.cjs +51 -0
  98. package/examples/react-compiler/vendor/invariant/invariant.d.cts +11 -0
  99. package/examples/react-compiler/vendor/invariant/types/LICENSE +21 -0
  100. package/examples/react-compiler/vendor/jridgewell/gen-mapping/LICENSE +19 -0
  101. package/examples/react-compiler/vendor/jridgewell/resolve-uri/LICENSE +19 -0
  102. package/examples/react-compiler/vendor/jridgewell/sourcemap-codec/LICENSE +19 -0
  103. package/examples/react-compiler/vendor/jridgewell/trace-mapping/LICENSE +19 -0
  104. package/examples/react-compiler/vendor/js-tokens/LICENSE +21 -0
  105. package/examples/react-compiler/vendor/js-tokens/index.cjs +23 -0
  106. package/examples/react-compiler/vendor/js-tokens/index.d.cts +13 -0
  107. package/examples/react-compiler/vendor/jsesc/LICENSE-MIT.txt +20 -0
  108. package/examples/react-compiler/vendor/jsesc/jsesc.cjs +337 -0
  109. package/examples/react-compiler/vendor/jsesc/jsesc.d.cts +384 -0
  110. package/examples/react-compiler/vendor/jsesc/types/LICENSE +21 -0
  111. package/examples/react-compiler/vendor/picocolors/LICENSE +15 -0
  112. package/examples/react-compiler/vendor/picocolors/picocolors.cjs +75 -0
  113. package/examples/react-compiler/vendor/picocolors/picocolors.d.cts +5 -0
  114. package/examples/react-compiler/vendor/picocolors/types.d.ts +51 -0
  115. package/examples/react-compiler/vendor/react-compiler/LICENSE +21 -0
  116. package/examples/react-compiler/vendor/stubs/babel-core.ts +31 -0
  117. package/examples/react-compiler/vendor/stubs/debug.ts +18 -0
  118. package/examples/react-compiler/vendor/stubs/js-tokens.d.ts +13 -0
  119. package/examples/react-compiler/vendor/stubs/pretty-format.ts +18 -0
  120. package/examples/react-compiler/vendor/zod/LICENSE +21 -0
  121. package/examples/react-compiler/vendor/zod-validation-error/LICENSE +9 -0
  122. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/NonEmptyArray.ts +5 -0
  123. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinPath.ts +49 -0
  124. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinValues.ts +48 -0
  125. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/stringify.ts +50 -0
  126. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/titleCase.ts +6 -0
  127. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/MessageBuilder.ts +126 -0
  128. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/ValidationError.ts +39 -0
  129. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/custom.ts +12 -0
  130. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/errorMap.ts +78 -0
  131. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/index.ts +2 -0
  132. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidElement.ts +12 -0
  133. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidKey.ts +12 -0
  134. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidStringFormat.ts +131 -0
  135. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidType.ts +54 -0
  136. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidUnion.ts +12 -0
  137. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidValue.ts +40 -0
  138. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/notMultipleOf.ts +12 -0
  139. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooBig.ts +76 -0
  140. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooSmall.ts +76 -0
  141. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/types.ts +27 -0
  142. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/unrecognizedKeys.ts +27 -0
  143. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromError.ts +13 -0
  144. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodError.ts +61 -0
  145. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodIssue.ts +38 -0
  146. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/index.ts +20 -0
  147. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationError.ts +5 -0
  148. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationErrorLike.ts +8 -0
  149. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isZodErrorLike.ts +11 -0
  150. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/toValidationError.ts +20 -0
  151. package/examples/react-compiler/vendor.mjs +688 -0
  152. package/examples/todo-cli/README.md +69 -0
  153. package/examples/todo-cli/bench.mjs +89 -0
  154. package/examples/todo-cli/main.ts +92 -0
  155. package/examples/yaml-cli/README.md +146 -0
  156. package/examples/yaml-cli/bench.mjs +265 -0
  157. package/examples/yaml-cli/main.ts +29 -0
  158. package/examples/yaml-cli/parity.mjs +156 -0
  159. package/examples/yaml-cli/vendor/yaml/LICENSE +13 -0
  160. package/examples/yaml-cli/vendor/yaml/VENDOR.md +25 -0
  161. package/govendor/github.com/jchv/go-webview2/LICENSE +22 -0
  162. package/govendor/github.com/jchv/go-webview2/README.md +21 -0
  163. package/govendor/github.com/jchv/go-webview2/common.go +84 -0
  164. package/govendor/github.com/jchv/go-webview2/go.mod +3 -0
  165. package/govendor/github.com/jchv/go-webview2/internal/w32/w32.go +194 -0
  166. package/govendor/github.com/jchv/go-webview2/internal/w32/w32_386.go +14 -0
  167. package/govendor/github.com/jchv/go-webview2/internal/w32/w32_64bit.go +15 -0
  168. package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_COLOR.go +8 -0
  169. package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND.go +9 -0
  170. package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_KEY_EVENT_KIND.go +10 -0
  171. package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_MOVE_FOCUS_REASON.go +9 -0
  172. package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_PHYSICAL_KEY_STATUS.go +10 -0
  173. package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_WEB_RESOURCE_CONTEXT.go +23 -0
  174. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2AcceleratorKeyPressedEventArgs.go +78 -0
  175. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2AcceleratorKeyPressedEventHandler.go +52 -0
  176. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2Controller.go +132 -0
  177. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2Controller2.go +74 -0
  178. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2CreateCoreWebView2ControllerCompletedHandler.go +48 -0
  179. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2NavigationCompletedEventArgs.go +17 -0
  180. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2NavigationCompletedEventHandler.go +48 -0
  181. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2Settings.go +270 -0
  182. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceRequest.go +43 -0
  183. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceRequestedEventArgs.go +51 -0
  184. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceRequestedEventHandler.go +48 -0
  185. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceResponse.go +21 -0
  186. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2_2.go +21 -0
  187. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2_3.go +60 -0
  188. package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebViewSettings.go +396 -0
  189. package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium.go +361 -0
  190. package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium_386.go +24 -0
  191. package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium_amd64.go +22 -0
  192. package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium_arm64.go +26 -0
  193. package/govendor/github.com/jchv/go-webview2/pkg/edge/comproc.go +13 -0
  194. package/govendor/github.com/jchv/go-webview2/pkg/edge/comproc_go17.go +51 -0
  195. package/govendor/github.com/jchv/go-webview2/pkg/edge/comproc_go18.go +16 -0
  196. package/govendor/github.com/jchv/go-webview2/pkg/edge/corewebview2.go +411 -0
  197. package/govendor/github.com/jchv/go-webview2/pkg/edge/guid.go +223 -0
  198. package/govendor/github.com/jchv/go-webview2/webview.go +482 -0
  199. package/govendor/github.com/jchv/go-webview2/webviewloader/README.md +3 -0
  200. package/govendor/github.com/jchv/go-webview2/webviewloader/module.go +153 -0
  201. package/govendor/github.com/jchv/go-webview2/webviewloader/module_386.go +6 -0
  202. package/govendor/github.com/jchv/go-webview2/webviewloader/module_amd64.go +6 -0
  203. package/govendor/github.com/jchv/go-webview2/webviewloader/module_arm64.go +6 -0
  204. package/govendor/github.com/jchv/go-webview2/webviewloader/sdk/arm64/WebView2Loader.dll +0 -0
  205. package/govendor/github.com/jchv/go-webview2/webviewloader/sdk/x64/WebView2Loader.dll +0 -0
  206. package/govendor/github.com/jchv/go-webview2/webviewloader/sdk/x86/WebView2Loader.dll +0 -0
  207. package/govendor/github.com/jchv/go-winloader/LICENSE.md +7 -0
  208. package/govendor/github.com/jchv/go-winloader/README.md +124 -0
  209. package/govendor/github.com/jchv/go-winloader/common.go +11 -0
  210. package/govendor/github.com/jchv/go-winloader/go.mod +3 -0
  211. package/govendor/github.com/jchv/go-winloader/internal/loader/loader.go +25 -0
  212. package/govendor/github.com/jchv/go-winloader/internal/loader/machine.go +53 -0
  213. package/govendor/github.com/jchv/go-winloader/internal/memloader/cache.go +42 -0
  214. package/govendor/github.com/jchv/go-winloader/internal/memloader/loader.go +253 -0
  215. package/govendor/github.com/jchv/go-winloader/internal/pe/export.go +76 -0
  216. package/govendor/github.com/jchv/go-winloader/internal/pe/format.go +522 -0
  217. package/govendor/github.com/jchv/go-winloader/internal/pe/import.go +106 -0
  218. package/govendor/github.com/jchv/go-winloader/internal/pe/module.go +91 -0
  219. package/govendor/github.com/jchv/go-winloader/internal/pe/reloc.go +177 -0
  220. package/govendor/github.com/jchv/go-winloader/internal/pe/util.go +40 -0
  221. package/govendor/github.com/jchv/go-winloader/internal/vmem/common.go +55 -0
  222. package/govendor/github.com/jchv/go-winloader/internal/vmem/memory_other.go +71 -0
  223. package/govendor/github.com/jchv/go-winloader/internal/vmem/memory_windows.go +179 -0
  224. package/govendor/github.com/jchv/go-winloader/internal/winloader/hacks_other.go +17 -0
  225. package/govendor/github.com/jchv/go-winloader/internal/winloader/hacks_windows.go +73 -0
  226. package/govendor/github.com/jchv/go-winloader/internal/winloader/loader_windows.go +64 -0
  227. package/govendor/github.com/jchv/go-winloader/internal/winloader/machine_windows.go +32 -0
  228. package/govendor/github.com/jchv/go-winloader/internal/winloader/nativearch_386.go +9 -0
  229. package/govendor/github.com/jchv/go-winloader/internal/winloader/nativearch_amd64.go +9 -0
  230. package/govendor/github.com/jchv/go-winloader/internal/winloader/nativearch_arm64.go +9 -0
  231. package/govendor/github.com/jchv/go-winloader/loader_other.go +24 -0
  232. package/govendor/github.com/jchv/go-winloader/loader_windows.go +33 -0
  233. package/govendor/manifest.txt +3 -1
  234. package/package.json +8 -5
  235. package/performance/README.md +195 -0
  236. package/performance/any-dynamic.ts +21 -0
  237. package/performance/any-record-view.ts +20 -0
  238. package/performance/arr-hof.ts +21 -0
  239. package/performance/arr-push-index.ts +15 -0
  240. package/performance/arr-sort.ts +21 -0
  241. package/performance/async-await.ts +24 -0
  242. package/performance/class-dispatch.ts +52 -0
  243. package/performance/events-emit.ts +27 -0
  244. package/performance/exc-throw-rare.ts +25 -0
  245. package/performance/exc-try-catch.ts +26 -0
  246. package/performance/fn-closures.ts +29 -0
  247. package/performance/fn-recursion-tree.ts +31 -0
  248. package/performance/gen-for-of.ts +46 -0
  249. package/performance/json-roundtrip.ts +27 -0
  250. package/performance/map-delete.ts +24 -0
  251. package/performance/map-string-keys.ts +22 -0
  252. package/performance/num-arith-loop.ts +14 -0
  253. package/performance/num-bitwise.ts +21 -0
  254. package/performance/num-mod-int.ts +16 -0
  255. package/performance/num-to-string.ts +16 -0
  256. package/performance/obj-alloc.ts +32 -0
  257. package/performance/regex-exec.ts +29 -0
  258. package/performance/regex-site.ts +28 -0
  259. package/performance/set-ops.ts +20 -0
  260. package/performance/str-char-scan.ts +35 -0
  261. package/performance/str-concat-plus.ts +18 -0
  262. package/performance/str-concat.ts +24 -0
  263. package/performance/str-short-scan.ts +26 -0
  264. package/performance/str-split-join.ts +23 -0
  265. package/performance/str-template.ts +16 -0
  266. package/performance/union-switch.ts +57 -0
  267. package/tsparser/check.go +2 -1
  268. package/tsparser/main.go +5 -0
  269. package/types/typenative-npm.d.ts +193 -4
  270. package/types/typenative.d.ts +138 -41
@@ -77,6 +77,7 @@ declare module 'node:buffer' {
77
77
 
78
78
  declare module 'node:fs' {
79
79
  import { Readable, Writable } from 'node:stream';
80
+ import { EventEmitter } from 'node:events';
80
81
  namespace fs {
81
82
  type PathLike = string;
82
83
  type EncodingOption = BufferEncoding | { encoding?: BufferEncoding | null; flag?: string } | null;
@@ -247,7 +248,7 @@ declare module 'node:fs' {
247
248
  encoding?: BufferEncoding;
248
249
  signal?: AbortSignal;
249
250
  }
250
- interface FSWatcher extends import('node:events').EventEmitter {
251
+ interface FSWatcher extends EventEmitter {
251
252
  close(): void;
252
253
  ref(): this;
253
254
  unref(): this;
@@ -258,7 +259,7 @@ declare module 'node:fs' {
258
259
  once(event: 'error', listener: (error: Error) => void): this;
259
260
  once(event: 'close', listener: () => void): this;
260
261
  }
261
- interface StatWatcher extends import('node:events').EventEmitter {
262
+ interface StatWatcher extends EventEmitter {
262
263
  ref(): this;
263
264
  unref(): this;
264
265
  }
@@ -513,8 +514,15 @@ declare module 'node:util' {
513
514
  value?: string;
514
515
  inlineValue?: boolean;
515
516
  }
516
- function parseArgs(config?: ParseArgsConfig): {
517
- values: Record<string, string | boolean | (string | boolean)[] | undefined>;
517
+ // The parsed value of an option: its type, an array of them when multiple
518
+ type ParseArgsOptionValue<O extends ParseArgsOptionConfig> = O['type'] extends 'string'
519
+ ? O['multiple'] extends true ? string[] : string
520
+ : O['multiple'] extends true ? boolean[] : boolean;
521
+ type ParseArgsValues<T extends ParseArgsConfig> = T['options'] extends Record<string, ParseArgsOptionConfig>
522
+ ? { -readonly [K in keyof T['options']]?: ParseArgsOptionValue<T['options'][K]> }
523
+ : Record<string, string | boolean | (string | boolean)[] | undefined>;
524
+ function parseArgs<T extends ParseArgsConfig>(config?: T): {
525
+ values: ParseArgsValues<T>;
518
526
  positionals: string[];
519
527
  tokens?: ParseArgsToken[];
520
528
  };
@@ -1247,6 +1255,8 @@ declare module 'node:stream' {
1247
1255
  resume(): this;
1248
1256
  isPaused(): boolean;
1249
1257
  pipe<T extends Writable>(destination: T, options?: { end?: boolean }): T;
1258
+ /** A stream to pipe into, or a function given this stream (an async generator over its chunks, a node:test reporter) */
1259
+ compose(stream: Duplex | ((source: any) => any)): Duplex;
1250
1260
  destroy(error?: Error): this;
1251
1261
  [Symbol.asyncIterator](): AsyncIterator<any>;
1252
1262
  static toWeb(streamReadable: Readable, options?: { strategy?: QueuingStrategy }): ReadableStream;
@@ -2463,6 +2473,7 @@ declare module 'node:async_hooks' {
2463
2473
  }
2464
2474
 
2465
2475
  declare module 'node:test' {
2476
+ import { Readable } from 'node:stream';
2466
2477
  function test(name?: string, fn?: test.TestFn): Promise<void>;
2467
2478
  function test(name?: string, options?: test.TestOptions, fn?: test.TestFn): Promise<void>;
2468
2479
  function test(fn?: test.TestFn): Promise<void>;
@@ -2499,9 +2510,22 @@ declare module 'node:test' {
2499
2510
  restore(): void;
2500
2511
  }
2501
2512
  export type Mock<F extends (...args: any[]) => any> = F & { mock: MockFunctionContext<F> };
2513
+ export interface MockFunctionOptions {
2514
+ times?: number;
2515
+ }
2516
+ export interface MockMethodOptions extends MockFunctionOptions {
2517
+ getter?: boolean;
2518
+ setter?: boolean;
2519
+ }
2520
+ type MockedMember<T> = T extends (...args: any[]) => any ? T : (...args: any[]) => any;
2502
2521
  export interface MockTracker {
2503
2522
  fn<F extends (...args: any[]) => any = (...args: any[]) => undefined>(original?: F): Mock<F>;
2504
2523
  fn<F extends (...args: any[]) => any, Implementation extends (...args: any[]) => any = F>(original: F, implementation: Implementation): Mock<F | Implementation>;
2524
+ /** Replaces object[methodName] (an object-literal method, a class instance's method, a namespace function such as console.log) until restore() */
2525
+ method<O extends object, K extends keyof O>(object: O, methodName: K, options?: MockMethodOptions): Mock<MockedMember<O[K]>>;
2526
+ method<O extends object, K extends keyof O>(object: O, methodName: K, implementation: (...args: any[]) => any, options?: MockMethodOptions): Mock<MockedMember<O[K]>>;
2527
+ getter<O extends object, K extends keyof O>(object: O, methodName: K, implementation?: (...args: any[]) => any, options?: MockFunctionOptions): Mock<() => O[K]>;
2528
+ setter<O extends object, K extends keyof O>(object: O, methodName: K, implementation?: (...args: any[]) => any, options?: MockFunctionOptions): Mock<(value: O[K]) => void>;
2505
2529
  reset(): void;
2506
2530
  restoreAll(): void;
2507
2531
  readonly timers: MockTimers;
@@ -2536,6 +2560,13 @@ declare module 'node:test' {
2536
2560
  doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
2537
2561
  fail(message?: string | Error): never;
2538
2562
  ifError(value: unknown): void;
2563
+ /** Compares with (or, with --test-update-snapshots, writes) the test file's <file>.snapshot entry */
2564
+ snapshot(value: any, options?: AssertSnapshotOptions): void;
2565
+ /** Compares with (or, with --test-update-snapshots, writes) the file at path */
2566
+ fileSnapshot(value: any, path: string, options?: AssertSnapshotOptions): void;
2567
+ }
2568
+ export interface AssertSnapshotOptions {
2569
+ serializers?: ReadonlyArray<(value: any) => any>;
2539
2570
  }
2540
2571
  export interface TestContext {
2541
2572
  readonly name: string;
@@ -2592,10 +2623,114 @@ declare module 'node:test' {
2592
2623
  export function after(fn?: HookFn, options?: TestOptions): void;
2593
2624
  export function beforeEach(fn?: HookFn, options?: TestOptions): void;
2594
2625
  export function afterEach(fn?: HookFn, options?: TestOptions): void;
2626
+ export namespace snapshot {
2627
+ function setDefaultSnapshotSerializers(serializers: ReadonlyArray<(value: any) => any>): void;
2628
+ function setResolveSnapshotPath(fn: (path: string | undefined) => string): void;
2629
+ }
2630
+ /** Runs each file (a literal path, compiled into the program) in a child process */
2631
+ export function run(options?: RunOptions): TestsStream;
2632
+ export interface RunOptions {
2633
+ files?: readonly string[];
2634
+ concurrency?: number | boolean;
2635
+ timeout?: number;
2636
+ only?: boolean;
2637
+ testNamePatterns?: string | RegExp | ReadonlyArray<string | RegExp>;
2638
+ testSkipPatterns?: string | RegExp | ReadonlyArray<string | RegExp>;
2639
+ coverage?: boolean;
2640
+ updateSnapshots?: boolean;
2641
+ cwd?: string;
2642
+ argv?: readonly string[];
2643
+ setup?: (reporter: TestsStream) => void | Promise<void>;
2644
+ }
2645
+ export interface TestsStream extends Readable {
2646
+ on(event: 'test:pass' | 'test:fail' | 'test:start' | 'test:complete' | 'test:enqueue' | 'test:dequeue', listener: (data: EventData.Test) => void): this;
2647
+ on(event: 'test:plan', listener: (data: EventData.TestPlan) => void): this;
2648
+ on(event: 'test:diagnostic' | 'test:stdout' | 'test:stderr', listener: (data: EventData.TestMessage) => void): this;
2649
+ on(event: 'test:summary', listener: (data: EventData.TestSummary) => void): this;
2650
+ on(event: 'test:coverage', listener: (data: EventData.TestCoverage) => void): this;
2651
+ on(event: string, listener: (...args: any[]) => void): this;
2652
+ once(event: 'test:pass' | 'test:fail' | 'test:start' | 'test:complete', listener: (data: EventData.Test) => void): this;
2653
+ once(event: 'test:summary', listener: (data: EventData.TestSummary) => void): this;
2654
+ once(event: string, listener: (...args: any[]) => void): this;
2655
+ }
2656
+ export namespace EventData {
2657
+ interface Location {
2658
+ file?: string;
2659
+ line?: number;
2660
+ column?: number;
2661
+ }
2662
+ interface Test extends Location {
2663
+ name: string;
2664
+ nesting: number;
2665
+ testNumber: number;
2666
+ details: { duration_ms: number; type: 'suite' | 'test'; error?: Error; passed?: boolean };
2667
+ skip?: string | boolean;
2668
+ todo?: string | boolean;
2669
+ }
2670
+ interface TestPlan extends Location {
2671
+ nesting: number;
2672
+ count: number;
2673
+ }
2674
+ interface TestMessage extends Location {
2675
+ nesting: number;
2676
+ message: string;
2677
+ level?: 'info' | 'warn' | 'error';
2678
+ }
2679
+ interface TestSummary {
2680
+ counts: { tests: number; failed: number; passed: number; cancelled: number; skipped: number; todo: number; topLevel: number; suites: number };
2681
+ duration_ms: number;
2682
+ file: string | undefined;
2683
+ success: boolean;
2684
+ }
2685
+ interface CoverageCounts {
2686
+ totalLineCount: number;
2687
+ totalBranchCount: number;
2688
+ totalFunctionCount: number;
2689
+ coveredLineCount: number;
2690
+ coveredBranchCount: number;
2691
+ coveredFunctionCount: number;
2692
+ coveredLinePercent: number;
2693
+ coveredBranchPercent: number;
2694
+ coveredFunctionPercent: number;
2695
+ }
2696
+ interface CoverageFile extends CoverageCounts {
2697
+ path: string;
2698
+ functions: { name: string; line: number; count: number }[];
2699
+ branches: { line: number; count: number }[];
2700
+ lines: { line: number; count: number }[];
2701
+ }
2702
+ interface TestCoverage {
2703
+ nesting: number;
2704
+ summary: { files: CoverageFile[]; totals: CoverageCounts; workingDirectory: string };
2705
+ }
2706
+ }
2595
2707
  }
2596
2708
  export = test;
2597
2709
  }
2598
2710
 
2711
+ // The reporters of node:test (--test-reporter), over run() streams and event sources
2712
+ declare module 'node:test/reporters' {
2713
+ import { Duplex } from 'node:stream';
2714
+ import { EventData } from 'node:test';
2715
+ type TestEvent =
2716
+ | { type: 'test:pass' | 'test:fail' | 'test:start' | 'test:complete' | 'test:enqueue' | 'test:dequeue'; data: EventData.Test }
2717
+ | { type: 'test:plan'; data: EventData.TestPlan }
2718
+ | { type: 'test:diagnostic' | 'test:stdout' | 'test:stderr'; data: EventData.TestMessage }
2719
+ | { type: 'test:summary'; data: EventData.TestSummary }
2720
+ | { type: 'test:coverage'; data: EventData.TestCoverage };
2721
+ type TestEventSource = AsyncIterable<TestEvent> | Iterable<TestEvent>;
2722
+ function tap(source: TestEventSource): AsyncGenerator<string, void>;
2723
+ function dot(source: TestEventSource): AsyncGenerator<string, void>;
2724
+ function junit(source: TestEventSource): AsyncGenerator<string, void>;
2725
+ interface ReporterConstructor {
2726
+ new (): Duplex;
2727
+ (): Duplex;
2728
+ }
2729
+ const spec: ReporterConstructor;
2730
+ const lcov: ReporterConstructor;
2731
+ export { tap, dot, junit, spec, lcov, TestEvent };
2732
+ }
2733
+
2599
2734
  declare module 'node:worker_threads' {
2600
2735
  import { EventEmitter } from 'node:events';
2601
2736
  namespace worker_threads {
@@ -2893,3 +3028,57 @@ declare module 'async_hooks' { import m = require('node:async_hooks'); export =
2893
3028
  declare module 'worker_threads' { import m = require('node:worker_threads'); export = m; }
2894
3029
  declare module 'cluster' { import m = require('node:cluster'); export = m; }
2895
3030
  declare module 'http2' { import m = require('node:http2'); export = m; }
3031
+
3032
+ // The npm package's API for native app windows, as far as compiled programs
3033
+ // implement it (under Node.js the real package runs). The real 'close' event can
3034
+ // be cancelled; compiled, the window is already gone, so preventDefault is absent.
3035
+ declare module '@webviewjs/webview' {
3036
+ interface ApplicationEvent {
3037
+ event: string;
3038
+ }
3039
+ interface WebContextOptions {
3040
+ // Where the webview keeps its profile. Needed under Node.js on Windows: the
3041
+ // default is beside node.exe, which Program Files makes read-only
3042
+ dataDirectory?: string;
3043
+ }
3044
+ interface BrowserWindowOptions {
3045
+ title?: string;
3046
+ width?: number;
3047
+ height?: number;
3048
+ // width and height in logical pixels, which follow the display's scaling, rather
3049
+ // than physical ones
3050
+ logical?: boolean;
3051
+ resizable?: boolean;
3052
+ }
3053
+ interface WebviewOptions {
3054
+ url?: string;
3055
+ html?: string;
3056
+ enableDevtools?: boolean;
3057
+ webContext?: WebContext | null;
3058
+ }
3059
+ class WebContext {}
3060
+ class Webview {
3061
+ loadUrl(url: string): void;
3062
+ loadHtml(html: string): void;
3063
+ evaluateScript(js: string): void;
3064
+ reload(): void;
3065
+ }
3066
+ class BrowserWindow {
3067
+ createWebview(options?: WebviewOptions): Webview;
3068
+ setTitle(title: string): void;
3069
+ close(): void;
3070
+ on(event: 'close', listener: (event: ApplicationEvent) => void): this;
3071
+ once(event: 'close', listener: (event: ApplicationEvent) => void): this;
3072
+ }
3073
+ type ApplicationEventName = 'ready' | 'window-close-requested' | 'application-close-requested';
3074
+ class Application {
3075
+ createWebContext(options?: WebContextOptions): WebContext;
3076
+ createBrowserWindow(options?: BrowserWindowOptions): BrowserWindow;
3077
+ isReady(): boolean;
3078
+ run(): void;
3079
+ whenReady(): Promise<void>;
3080
+ exit(): void;
3081
+ on(event: ApplicationEventName, listener: (event: ApplicationEvent) => void): this;
3082
+ once(event: ApplicationEventName, listener: (event: ApplicationEvent) => void): this;
3083
+ }
3084
+ }
@@ -15,9 +15,22 @@ interface Function {
15
15
  bind(thisArg: any, ...argArray: any[]): any;
16
16
  }
17
17
 
18
- interface CallableFunction extends Function {}
18
+ // With strict, f.call / f.apply / f.bind are checked against f's signature
19
+ // (strictBindCallApply), as in TypeScript's own lib
20
+ interface CallableFunction extends Function {
21
+ apply<T, R>(this: (this: T) => R, thisArg: T): R;
22
+ apply<T, A extends any[], R>(this: (this: T, ...args: A) => R, thisArg: T, args: A): R;
23
+ call<T, A extends any[], R>(this: (this: T, ...args: A) => R, thisArg: T, ...args: A): R;
24
+ }
19
25
  interface NewableFunction extends Function {}
20
26
 
27
+ /** The global `Function` as a value: an opaque constructor (`x instanceof Function` checks for a function). `new Function(...)` compiles to a binary that throws if the program ever calls the result: a native binary cannot evaluate dynamic code */
28
+ interface FunctionConstructor extends Function {
29
+ new (...args: string[]): Function;
30
+ (...args: string[]): Function;
31
+ }
32
+ declare var Function: FunctionConstructor;
33
+
21
34
  interface IArguments {
22
35
  [index: number]: any;
23
36
  length: number;
@@ -30,9 +43,13 @@ interface Number {
30
43
  toExponential(fractionDigits?: number): string;
31
44
  }
32
45
 
46
+ type PropertyKey = string | number | symbol;
47
+
33
48
  interface Object {
34
49
  constructor: Function;
35
50
  toString(): string;
51
+ valueOf(): Object;
52
+ hasOwnProperty(v: PropertyKey): boolean;
36
53
  }
37
54
 
38
55
  // --- Iteration protocol (also unlocks for..of / spread over Map, Set, string) ---
@@ -109,11 +126,14 @@ interface Disposable {
109
126
  [Symbol.dispose](): void;
110
127
  }
111
128
 
112
- // await unwraps one thenable layer at a time
129
+ // await unwraps one thenable layer at a time (TypeScript's own definition,
130
+ // which the checker relates to T for generic T)
113
131
  type Awaited<T> = T extends null | undefined
114
132
  ? T
115
- : T extends { then(onfulfilled: (value: infer U) => any): any }
116
- ? Awaited<U>
133
+ : T extends object & { then(onfulfilled: infer F, ...args: infer _): any }
134
+ ? F extends (value: infer V, ...args: infer _) => any
135
+ ? Awaited<V>
136
+ : never
117
137
  : T;
118
138
 
119
139
  // Tagged template functions: tag`a${x}b`
@@ -140,6 +160,8 @@ type NonNullable<T> = T & {};
140
160
  type Record<K extends keyof any, T> = { [P in K]: T };
141
161
  type Parameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never;
142
162
  type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;
163
+ type Exclude<T, U> = T extends U ? never : T;
164
+ type Extract<T, U> = T extends U ? T : never;
143
165
 
144
166
  // --- RegExp ---
145
167
 
@@ -152,6 +174,7 @@ interface RegExp {
152
174
  readonly multiline: boolean;
153
175
  readonly dotAll: boolean;
154
176
  readonly unicode: boolean;
177
+ readonly unicodeSets: boolean;
155
178
  readonly sticky: boolean;
156
179
  test(string: string): boolean;
157
180
  exec(string: string): RegExpExecArray | null;
@@ -206,55 +229,57 @@ interface Array<T> extends IterableIterator<T> {
206
229
  /**
207
230
  * Calls a defined callback function on each element of an array, and returns an array that contains the results.
208
231
  */
209
- map<U>(callback: (value: T, index?: number, array?: T[]) => U): U[];
232
+ map<U>(callback: (value: T, index: number, array: T[]) => U): U[];
210
233
  /**
211
234
  * Returns the elements of an array that meet the condition specified in a callback function.
212
235
  */
213
- filter(callback: (value: T, index?: number, array?: T[]) => boolean): T[];
236
+ filter<S extends T>(callback: (value: T, index: number, array: T[]) => value is S): S[];
237
+ filter(callback: (value: T, index: number, array: T[]) => unknown): T[];
214
238
  /**
215
239
  * Determines whether the specified callback function returns true for any element of an array.
216
240
  */
217
- some(callback: (value: T, index?: number, array?: T[]) => boolean): boolean;
241
+ some(callback: (value: T, index: number, array: T[]) => unknown): boolean;
218
242
  /**
219
243
  * Returns the value of the first element in the array where callback is true, and undefined otherwise.
220
244
  */
221
- find(callback: (value: T, index?: number, array?: T[]) => boolean): T | undefined;
245
+ find<S extends T>(callback: (value: T, index: number, array: T[]) => value is S): S | undefined;
246
+ find(callback: (value: T, index: number, array: T[]) => unknown): T | undefined;
222
247
  /**
223
248
  * Returns the index of the first element that satisfies the callback, or -1.
224
249
  */
225
- findIndex(callback: (value: T, index?: number, array?: T[]) => boolean): number;
250
+ findIndex(callback: (value: T, index: number, array: T[]) => unknown): number;
226
251
  /**
227
252
  * Returns the value of the last element where callback is true, and undefined otherwise.
228
253
  */
229
- findLast(callback: (value: T, index?: number, array?: T[]) => boolean): T | undefined;
254
+ findLast(callback: (value: T, index: number, array: T[]) => unknown): T | undefined;
230
255
  /**
231
256
  * Returns the index of the last element that satisfies the callback, or -1.
232
257
  */
233
- findLastIndex(callback: (value: T, index?: number, array?: T[]) => boolean): number;
258
+ findLastIndex(callback: (value: T, index: number, array: T[]) => unknown): number;
234
259
  /**
235
260
  * Determines whether all elements satisfy the callback.
236
261
  */
237
- every(callback: (value: T, index?: number, array?: T[]) => boolean): boolean;
262
+ every(callback: (value: T, index: number, array: T[]) => unknown): boolean;
238
263
  /**
239
264
  * Performs the callback for each element.
240
265
  */
241
- forEach(callback: (value: T, index?: number, array?: T[]) => void): void;
266
+ forEach(callback: (value: T, index: number, array: T[]) => void): void;
242
267
  /**
243
268
  * Calls the callback function on each element of the array, accumulating a result.
244
269
  */
245
270
  reduce<U>(
246
- callback: (accumulator: U, value: T, index?: number, array?: T[]) => U,
271
+ callback: (accumulator: U, value: T, index: number, array: T[]) => U,
247
272
  initialValue: U
248
273
  ): U;
249
- reduce(callback: (accumulator: T, value: T, index?: number, array?: T[]) => T): T;
274
+ reduce(callback: (accumulator: T, value: T, index: number, array: T[]) => T): T;
250
275
  /**
251
276
  * Calls the callback function on each element of the array in reverse order, accumulating a result.
252
277
  */
253
278
  reduceRight<U>(
254
- callback: (accumulator: U, value: T, index?: number, array?: T[]) => U,
279
+ callback: (accumulator: U, value: T, index: number, array: T[]) => U,
255
280
  initialValue: U
256
281
  ): U;
257
- reduceRight(callback: (accumulator: T, value: T, index?: number, array?: T[]) => T): T;
282
+ reduceRight(callback: (accumulator: T, value: T, index: number, array: T[]) => T): T;
258
283
  /**
259
284
  * Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
260
285
  */
@@ -282,7 +307,7 @@ interface Array<T> extends IterableIterator<T> {
282
307
  /**
283
308
  * Reverses the elements of an array in place.
284
309
  */
285
- reverse(): T[];
310
+ reverse(): this;
286
311
  /**
287
312
  * Returns a reversed copy of the array.
288
313
  */
@@ -290,7 +315,7 @@ interface Array<T> extends IterableIterator<T> {
290
315
  /**
291
316
  * Sorts the elements of an array in place.
292
317
  */
293
- sort(compareFn?: (a: T, b: T) => number): T[];
318
+ sort(compareFn?: (a: T, b: T) => number): this;
294
319
  /**
295
320
  * Returns a sorted copy of the array.
296
321
  */
@@ -310,16 +335,16 @@ interface Array<T> extends IterableIterator<T> {
310
335
  /**
311
336
  * Returns a new array formed by applying callback to each element and then flattening.
312
337
  */
313
- flat(): T[];
314
- flatMap<U>(callback: (value: T, index?: number, array?: T[]) => U[]): U[];
338
+ flat(depth?: number): T[];
339
+ flatMap<U>(callback: (value: T, index: number, array: T[]) => U[]): U[];
315
340
  /**
316
341
  * Returns a copy of a section of an array with the fill value applied.
317
342
  */
318
- fill(value: T, start?: number, end?: number): T[];
343
+ fill(value: T, start?: number, end?: number): this;
319
344
  /**
320
345
  * Copies within the array in place (overlap-safe) and returns it.
321
346
  */
322
- copyWithin(target: number, start: number, end?: number): T[];
347
+ copyWithin(target: number, start: number, end?: number): this;
323
348
  /**
324
349
  * Merges two or more arrays (array arguments are flattened one level).
325
350
  */
@@ -340,12 +365,19 @@ interface Array<T> extends IterableIterator<T> {
340
365
  [n: number]: T;
341
366
  }
342
367
 
368
+ /** The read-only view of a Set: the same values, no mutating members used */
369
+ type ReadonlySet<T> = Set<T>;
370
+
343
371
  interface ArrayConstructor {
344
372
  new <T>(length: number): T[];
373
+ new <T>(...items: T[]): T[];
374
+ <T>(length: number): T[];
375
+ <T>(...items: T[]): T[];
345
376
  isArray(arg: any): arg is any[];
346
- from<T>(arrayLike: ArrayLike<T>): T[];
347
- from<T, U>(arrayLike: ArrayLike<T>, mapFn: (value: T, index: number) => U): U[];
377
+ from<T>(arrayLike: ArrayLike<T> | Iterable<T>): T[];
378
+ from<T, U>(arrayLike: ArrayLike<T> | Iterable<T>, mapFn: (value: T, index: number) => U): U[];
348
379
  of<T>(...items: T[]): T[];
380
+ readonly prototype: any[];
349
381
  }
350
382
 
351
383
  declare var Array: ArrayConstructor;
@@ -374,11 +406,11 @@ interface String {
374
406
  isWellFormed(): boolean;
375
407
  toWellFormed(): string;
376
408
  /** Determines whether a string contains the specified substring. */
377
- includes(searchString: string): boolean;
409
+ includes(searchString: string, position?: number): boolean;
378
410
  /** Determines whether a string begins with the specified characters. */
379
- startsWith(searchString: string): boolean;
411
+ startsWith(searchString: string, position?: number): boolean;
380
412
  /** Determines whether a string ends with the specified characters. */
381
- endsWith(searchString: string): boolean;
413
+ endsWith(searchString: string, endPosition?: number): boolean;
382
414
  /** Splits a string into substrings using the specified separator. */
383
415
  split(separator: string | RegExp, limit?: number): string[];
384
416
  /** Removes whitespace from both ends of a string. */
@@ -438,9 +470,9 @@ declare var String: StringConstructor;
438
470
 
439
471
  interface NumberConstructor {
440
472
  (value?: any): number;
441
- isNaN(value: number): boolean;
442
- isFinite(value: number): boolean;
443
- isInteger(value: number): boolean;
473
+ isNaN(value: unknown): boolean;
474
+ isFinite(value: unknown): boolean;
475
+ isInteger(value: unknown): boolean;
444
476
  readonly MAX_SAFE_INTEGER: number;
445
477
  readonly MIN_SAFE_INTEGER: number;
446
478
  readonly MAX_VALUE: number;
@@ -534,6 +566,8 @@ declare function isNaN(number: number): boolean;
534
566
  declare function isFinite(number: number): boolean;
535
567
  declare function encodeURIComponent(uriComponent: string): string;
536
568
  declare function decodeURIComponent(uriComponent: string): string;
569
+ declare function encodeURI(uri: string): string;
570
+ declare function decodeURI(encodedURI: string): string;
537
571
  declare function structuredClone<T>(value: T): T;
538
572
 
539
573
  // The running program (a native binary has no separate script file)
@@ -573,7 +607,26 @@ interface JSON {
573
607
  }
574
608
  declare var JSON: JSON;
575
609
 
610
+ interface PropertyDescriptor {
611
+ value?: any;
612
+ writable?: boolean;
613
+ enumerable?: boolean;
614
+ configurable?: boolean;
615
+ get?(): any;
616
+ set?(v: any): void;
617
+ }
618
+ interface PropertyDescriptorMap {
619
+ [key: string]: PropertyDescriptor;
620
+ }
621
+
576
622
  interface ObjectConstructor {
623
+ /** Object(x) returns x (primitives are not boxed) */
624
+ (value?: any): any;
625
+ new (value?: any): any;
626
+ /** A class value stands in for its prototype (Object.create(C.prototype)) */
627
+ readonly prototype: Object;
628
+ /** Only `Object.setPrototypeOf(this, …)` in a constructor (the Error-subclassing idiom), as a no-op */
629
+ setPrototypeOf(o: any, proto: object | null): any;
577
630
  /** SameValue: NaN is NaN, +0 is not -0 */
578
631
  is(a: any, b: any): boolean;
579
632
  groupBy<T>(items: T[], keySelector: (item: T, index: number) => string | number): Record<string, T[]>;
@@ -583,11 +636,16 @@ interface ObjectConstructor {
583
636
  assign(target: any, ...sources: any[]): any;
584
637
  fromEntries(entries: Iterable<readonly [string, any]>): any;
585
638
  hasOwn(obj: any, key: string): boolean;
586
- defineProperty<T>(
587
- obj: T,
588
- key: string,
589
- descriptor: { value: any; enumerable?: boolean; writable?: boolean; configurable?: boolean }
590
- ): T;
639
+ /** Data descriptors set the value; attributes and accessors have no effect */
640
+ defineProperty<T>(obj: T, key: string, descriptor: PropertyDescriptor): T;
641
+ defineProperties<T>(obj: T, descriptors: PropertyDescriptorMap): T;
642
+ /** An instance of the prototype's class without running its constructor */
643
+ create(proto: object | null, descriptors?: PropertyDescriptorMap): any;
644
+ /** An instance's class (null for other values) */
645
+ getPrototypeOf(obj: any): any;
646
+ getOwnPropertyDescriptors<T>(obj: T): { [P in keyof T]: PropertyDescriptor } & { [key: string]: PropertyDescriptor };
647
+ getOwnPropertyDescriptor(obj: any, key: PropertyKey): PropertyDescriptor | undefined;
648
+ getOwnPropertySymbols(obj: any): symbol[];
591
649
  getOwnPropertyNames(obj: any): string[];
592
650
  freeze<T>(obj: T): T;
593
651
  seal<T>(obj: T): T;
@@ -632,7 +690,7 @@ interface Process {
632
690
  };
633
691
  nextTick<A extends any[]>(callback: (...args: A) => void, ...args: A): void;
634
692
  kill(pid: number, signal?: string | number): true;
635
- emitWarning(warning: string | Error): void;
693
+ emitWarning(warning: string | Error, type?: string): void;
636
694
  getuid(): number;
637
695
  getgid(): number;
638
696
  geteuid(): number;
@@ -710,6 +768,10 @@ interface ErrorOptions {
710
768
  interface ErrorConstructor {
711
769
  new (message?: string, options?: ErrorOptions): Error;
712
770
  (message?: string, options?: ErrorOptions): Error;
771
+ // (V8's: accepted, without effect — there are no V8 stack frames)
772
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
773
+ stackTraceLimit: number;
774
+ prepareStackTrace?: (err: Error, stackTraces: any[]) => any;
713
775
  }
714
776
 
715
777
  declare var Error: ErrorConstructor;
@@ -827,12 +889,12 @@ interface PromiseLike<T> {
827
889
 
828
890
  interface PromiseConstructor {
829
891
  new <T>(
830
- executor: (resolve: (value: T) => void, reject?: (reason?: any) => void) => void
892
+ executor: (resolve: (value: T) => void, reject: (reason?: any) => void) => void
831
893
  ): Promise<T>;
832
894
  resolve(): Promise<void>;
833
895
  resolve<T>(value: T): Promise<T>;
834
896
  reject(reason?: any): Promise<never>;
835
- all<T>(values: Promise<T>[]): Promise<T[]>;
897
+ all<T>(values: (T | PromiseLike<T>)[]): Promise<Awaited<T>[]>;
836
898
  race<T>(values: Promise<T>[]): Promise<T>;
837
899
  any<T>(values: Promise<T>[]): Promise<T>;
838
900
  allSettled<T>(values: Promise<T>[]): Promise<{ status: string; value?: T; reason?: any }[]>;
@@ -891,7 +953,7 @@ interface Map<K, V> {
891
953
 
892
954
  interface MapConstructor {
893
955
  new <K, V>(): Map<K, V>;
894
- new <K, V>(entries: [K, V][]): Map<K, V>;
956
+ new <K, V>(entries?: readonly (readonly [K, V])[] | Iterable<readonly [K, V]> | null): Map<K, V>;
895
957
  groupBy<K, T>(items: T[], keySelector: (item: T, index: number) => K): Map<K, T[]>;
896
958
  }
897
959
 
@@ -925,7 +987,7 @@ interface Set<T> {
925
987
 
926
988
  interface SetConstructor {
927
989
  new <T>(): Set<T>;
928
- new <T>(values?: T[] | Set<T>): Set<T>;
990
+ new <T>(values?: readonly T[] | Set<T> | Iterable<T> | null): Set<T>;
929
991
  }
930
992
 
931
993
  declare var Set: SetConstructor;
@@ -1038,6 +1100,8 @@ interface Uint8Array {
1038
1100
  slice(start?: number, end?: number): Uint8Array;
1039
1101
  set(array: ArrayLike<number>, offset?: number): void;
1040
1102
  at(index: number): number | undefined;
1103
+ /** Base64 of the bytes (ES2026) */
1104
+ toBase64(): string;
1041
1105
  [Symbol.iterator](): IterableIterator<number>;
1042
1106
  }
1043
1107
 
@@ -1047,6 +1111,8 @@ interface Uint8ArrayConstructor {
1047
1111
  // A view sharing the buffer's memory
1048
1112
  new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array;
1049
1113
  from(arrayLike: ArrayLike<number> | Iterable<number>): Uint8Array;
1114
+ /** The bytes a base64 string encodes (ES2026) */
1115
+ fromBase64(base64: string): Uint8Array;
1050
1116
  }
1051
1117
 
1052
1118
  declare var Uint8Array: Uint8ArrayConstructor;
@@ -1239,6 +1305,8 @@ interface Buffer extends Uint8Array {
1239
1305
  }
1240
1306
 
1241
1307
  interface BufferConstructor {
1308
+ /** @deprecated use Buffer.alloc / Buffer.from (lets `typeof Buffer === 'function'` narrow) */
1309
+ new (size: number): Buffer;
1242
1310
  from(data: string, encoding?: BufferEncoding): Buffer;
1243
1311
  from(data: ArrayLike<number> | Uint8Array | ArrayBuffer): Buffer;
1244
1312
  alloc(size: number, fill?: string | number | Uint8Array, encoding?: BufferEncoding): Buffer;
@@ -1627,6 +1695,22 @@ declare function setImmediate<A extends any[]>(callback: (...args: A) => void, .
1627
1695
  declare function clearImmediate(immediate?: NodeJS.Immediate | number): void;
1628
1696
 
1629
1697
  declare namespace NodeJS {
1698
+ // A readable stream, as Node's typings describe it (process.stdin is one)
1699
+ interface ReadableStream {
1700
+ readonly readable: boolean;
1701
+ read(size?: number): any;
1702
+ setEncoding(encoding: BufferEncoding): this;
1703
+ pause(): this;
1704
+ resume(): this;
1705
+ isPaused(): boolean;
1706
+ on(event: string, listener: (...args: any[]) => void): this;
1707
+ once(event: string, listener: (...args: any[]) => void): this;
1708
+ }
1709
+ interface WritableStream {
1710
+ readonly writable: boolean;
1711
+ write(chunk: any, callback?: (error?: Error | null) => void): boolean;
1712
+ on(event: string, listener: (...args: any[]) => void): this;
1713
+ }
1630
1714
  // Timer handles: an unref'ed timer does not keep the process alive
1631
1715
  interface Timeout {
1632
1716
  ref(): this;
@@ -1671,3 +1755,16 @@ declare namespace JSX {
1671
1755
  children: {};
1672
1756
  }
1673
1757
  }
1758
+
1759
+ // Reflect: the Object operations as functions
1760
+ declare namespace Reflect {
1761
+ function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
1762
+ function defineProperty(target: object, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
1763
+ function deleteProperty(target: object, propertyKey: PropertyKey): boolean;
1764
+ function get(target: object, propertyKey: PropertyKey, receiver?: any): any;
1765
+ function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor | undefined;
1766
+ function getPrototypeOf(target: object): object | null;
1767
+ function has(target: object, propertyKey: PropertyKey): boolean;
1768
+ function ownKeys(target: object): (string | symbol)[];
1769
+ function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
1770
+ }