typenative 0.1.2 → 0.2.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 (504) hide show
  1. package/.gitattributes +1 -0
  2. package/.github/workflows/ci.yml +1 -1
  3. package/.github/workflows/npm-publish-github-packages.yml +1 -1
  4. package/CHANGELOG.md +247 -0
  5. package/CONTRIBUTION.md +1 -1
  6. package/README.md +30 -21
  7. package/bin/cli.js +3 -1
  8. package/bin/go/bridge.js +919 -0
  9. package/bin/go/convert.js +238 -0
  10. package/bin/go/metadata.js +211 -0
  11. package/bin/go/overrides.js +68 -0
  12. package/bin/go/stdlib.generated.js +175 -0
  13. package/bin/index.js +98 -6
  14. package/bin/main.js +4 -1
  15. package/bin/node/assert.js +344 -0
  16. package/bin/node/async_hooks.js +273 -0
  17. package/bin/node/buffer.js +765 -0
  18. package/bin/node/child_process.js +600 -0
  19. package/bin/node/cluster.js +1002 -0
  20. package/bin/node/console.js +121 -0
  21. package/bin/node/core.js +111 -0
  22. package/bin/node/crypto.js +414 -0
  23. package/bin/node/crypto_keys.js +2685 -0
  24. package/bin/node/dgram.js +388 -0
  25. package/bin/node/diagnostics_channel.js +534 -0
  26. package/bin/node/dns.js +635 -0
  27. package/bin/node/events.js +743 -0
  28. package/bin/node/fetch.js +737 -0
  29. package/bin/node/fs.js +998 -0
  30. package/bin/node/http.js +1500 -0
  31. package/bin/node/http2.js +688 -0
  32. package/bin/node/net.js +1143 -0
  33. package/bin/node/os.js +257 -0
  34. package/bin/node/path.js +758 -0
  35. package/bin/node/process.js +316 -0
  36. package/bin/node/punycode.js +195 -0
  37. package/bin/node/querystring.js +143 -0
  38. package/bin/node/readline.js +299 -0
  39. package/bin/node/registry.js +161 -0
  40. package/bin/node/sqlite.js +1142 -0
  41. package/bin/node/stream.js +1221 -0
  42. package/bin/node/stream_web.js +2259 -0
  43. package/bin/node/string_decoder.js +101 -0
  44. package/bin/node/system_extra.js +661 -0
  45. package/bin/node/test.js +1068 -0
  46. package/bin/node/timers.js +250 -0
  47. package/bin/node/tls.js +719 -0
  48. package/bin/node/url.js +861 -0
  49. package/bin/node/util.js +1311 -0
  50. package/bin/node/util_extra.js +599 -0
  51. package/bin/node/worker_threads.js +745 -0
  52. package/bin/node/zlib.js +263 -0
  53. package/bin/parse-native.js +3 -2
  54. package/bin/parse-node.js +18 -2
  55. package/bin/transpiler.js +3529 -597
  56. package/bin/version.js +2 -0
  57. package/conformance.md +724 -258
  58. package/govendor/github.com/ncruces/go-sqlite3/LICENSE +21 -0
  59. package/govendor/github.com/ncruces/go-sqlite3/README.md +121 -0
  60. package/govendor/github.com/ncruces/go-sqlite3/backup.go +132 -0
  61. package/govendor/github.com/ncruces/go-sqlite3/blob.go +266 -0
  62. package/govendor/github.com/ncruces/go-sqlite3/config.go +397 -0
  63. package/govendor/github.com/ncruces/go-sqlite3/conn.go +540 -0
  64. package/govendor/github.com/ncruces/go-sqlite3/conn_127.go +93 -0
  65. package/govendor/github.com/ncruces/go-sqlite3/const.go +436 -0
  66. package/govendor/github.com/ncruces/go-sqlite3/context.go +222 -0
  67. package/govendor/github.com/ncruces/go-sqlite3/error.go +182 -0
  68. package/govendor/github.com/ncruces/go-sqlite3/ext.go +153 -0
  69. package/govendor/github.com/ncruces/go-sqlite3/func.go +309 -0
  70. package/govendor/github.com/ncruces/go-sqlite3/go.mod +3 -0
  71. package/govendor/github.com/ncruces/go-sqlite3/internal/dotlk/dotlk.go +29 -0
  72. package/govendor/github.com/ncruces/go-sqlite3/internal/dotlk/dotlk_other.go +13 -0
  73. package/govendor/github.com/ncruces/go-sqlite3/internal/dotlk/dotlk_unix.go +57 -0
  74. package/govendor/github.com/ncruces/go-sqlite3/internal/errutil/error.go +41 -0
  75. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/alloc.go +128 -0
  76. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/const.go +122 -0
  77. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/error.go +77 -0
  78. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/mem.go +116 -0
  79. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/mem_other.go +34 -0
  80. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/mem_unix.go +87 -0
  81. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/mem_windows.go +149 -0
  82. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/mmap_unix.go +80 -0
  83. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/mmap_windows.go +129 -0
  84. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/sys_windows.go +60 -0
  85. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/wrap.go +82 -0
  86. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/wrap_sys.go +113 -0
  87. package/govendor/github.com/ncruces/go-sqlite3/internal/sqlite3_wrap/wrap_vfs.go +181 -0
  88. package/govendor/github.com/ncruces/go-sqlite3/internal/testenv/env.go +55 -0
  89. package/govendor/github.com/ncruces/go-sqlite3/internal/util/json.go +54 -0
  90. package/govendor/github.com/ncruces/go-sqlite3/internal/util/json_v2.go +54 -0
  91. package/govendor/github.com/ncruces/go-sqlite3/internal/util/math.go +29 -0
  92. package/govendor/github.com/ncruces/go-sqlite3/internal/util/page.go +5 -0
  93. package/govendor/github.com/ncruces/go-sqlite3/internal/util/parse.go +142 -0
  94. package/govendor/github.com/ncruces/go-sqlite3/internal/util/pointer.go +3 -0
  95. package/govendor/github.com/ncruces/go-sqlite3/internal/util/reflect.go +10 -0
  96. package/govendor/github.com/ncruces/go-sqlite3/json.go +100 -0
  97. package/govendor/github.com/ncruces/go-sqlite3/json_v2.go +116 -0
  98. package/govendor/github.com/ncruces/go-sqlite3/pointer.go +13 -0
  99. package/govendor/github.com/ncruces/go-sqlite3/quote.go +140 -0
  100. package/govendor/github.com/ncruces/go-sqlite3/stmt.go +692 -0
  101. package/govendor/github.com/ncruces/go-sqlite3/time.go +360 -0
  102. package/govendor/github.com/ncruces/go-sqlite3/txn.go +374 -0
  103. package/govendor/github.com/ncruces/go-sqlite3/value.go +212 -0
  104. package/govendor/github.com/ncruces/go-sqlite3/vfs/README.md +133 -0
  105. package/govendor/github.com/ncruces/go-sqlite3/vfs/api.go +239 -0
  106. package/govendor/github.com/ncruces/go-sqlite3/vfs/cksm.go +143 -0
  107. package/govendor/github.com/ncruces/go-sqlite3/vfs/const.go +256 -0
  108. package/govendor/github.com/ncruces/go-sqlite3/vfs/file.go +260 -0
  109. package/govendor/github.com/ncruces/go-sqlite3/vfs/filename.go +187 -0
  110. package/govendor/github.com/ncruces/go-sqlite3/vfs/lock.go +128 -0
  111. package/govendor/github.com/ncruces/go-sqlite3/vfs/lock_other.go +23 -0
  112. package/govendor/github.com/ncruces/go-sqlite3/vfs/map.go +63 -0
  113. package/govendor/github.com/ncruces/go-sqlite3/vfs/map_other.go +13 -0
  114. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_bsd.go +110 -0
  115. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_darwin.go +131 -0
  116. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_dotlk.go +140 -0
  117. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_f2fs_linux.go +56 -0
  118. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_linux.go +117 -0
  119. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_ofd.go +59 -0
  120. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_std.go +50 -0
  121. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_std_alloc.go +19 -0
  122. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_std_atomic.go +9 -0
  123. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_std_rw.go +13 -0
  124. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_std_sync.go +9 -0
  125. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_std_temp.go +16 -0
  126. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go +108 -0
  127. package/govendor/github.com/ncruces/go-sqlite3/vfs/os_windows.go +180 -0
  128. package/govendor/github.com/ncruces/go-sqlite3/vfs/registry.go +48 -0
  129. package/govendor/github.com/ncruces/go-sqlite3/vfs/shm.go +26 -0
  130. package/govendor/github.com/ncruces/go-sqlite3/vfs/shm_bsd.go +258 -0
  131. package/govendor/github.com/ncruces/go-sqlite3/vfs/shm_copy.go +90 -0
  132. package/govendor/github.com/ncruces/go-sqlite3/vfs/shm_dotlk.go +168 -0
  133. package/govendor/github.com/ncruces/go-sqlite3/vfs/shm_memlk.go +52 -0
  134. package/govendor/github.com/ncruces/go-sqlite3/vfs/shm_ofd.go +185 -0
  135. package/govendor/github.com/ncruces/go-sqlite3/vfs/shm_other.go +21 -0
  136. package/govendor/github.com/ncruces/go-sqlite3/vfs/shm_windows.go +124 -0
  137. package/govendor/github.com/ncruces/go-sqlite3/vfs/vfs.go +455 -0
  138. package/govendor/github.com/ncruces/go-sqlite3/vtab.go +677 -0
  139. package/govendor/github.com/ncruces/go-sqlite3/wrap.go +48 -0
  140. package/govendor/github.com/ncruces/go-sqlite3-wasm/v6/LICENSE +18 -0
  141. package/govendor/github.com/ncruces/go-sqlite3-wasm/v6/README.md +11 -0
  142. package/govendor/github.com/ncruces/go-sqlite3-wasm/v6/go.mod +3 -0
  143. package/govendor/github.com/ncruces/go-sqlite3-wasm/v6/libc.go +215 -0
  144. package/govendor/github.com/ncruces/go-sqlite3-wasm/v6/sqlite3.dat +0 -0
  145. package/govendor/github.com/ncruces/go-sqlite3-wasm/v6/sqlite3.go +157903 -0
  146. package/govendor/github.com/ncruces/go-sqlite3-wasm/v6/tools.sh +38 -0
  147. package/govendor/github.com/ncruces/julianday/LICENSE +21 -0
  148. package/govendor/github.com/ncruces/julianday/README.md +9 -0
  149. package/govendor/github.com/ncruces/julianday/go.mod +3 -0
  150. package/govendor/github.com/ncruces/julianday/julianday.go +124 -0
  151. package/govendor/golang.org/x/sys/LICENSE +27 -0
  152. package/govendor/golang.org/x/sys/PATENTS +22 -0
  153. package/govendor/golang.org/x/sys/go.mod +3 -0
  154. package/govendor/golang.org/x/sys/unix/README.md +184 -0
  155. package/govendor/golang.org/x/sys/unix/affinity_linux.go +189 -0
  156. package/govendor/golang.org/x/sys/unix/aliases.go +13 -0
  157. package/govendor/golang.org/x/sys/unix/asm_aix_ppc64.s +17 -0
  158. package/govendor/golang.org/x/sys/unix/asm_bsd_386.s +27 -0
  159. package/govendor/golang.org/x/sys/unix/asm_bsd_amd64.s +27 -0
  160. package/govendor/golang.org/x/sys/unix/asm_bsd_arm.s +27 -0
  161. package/govendor/golang.org/x/sys/unix/asm_bsd_arm64.s +27 -0
  162. package/govendor/golang.org/x/sys/unix/asm_bsd_ppc64.s +29 -0
  163. package/govendor/golang.org/x/sys/unix/asm_bsd_riscv64.s +27 -0
  164. package/govendor/golang.org/x/sys/unix/asm_linux_386.s +65 -0
  165. package/govendor/golang.org/x/sys/unix/asm_linux_amd64.s +57 -0
  166. package/govendor/golang.org/x/sys/unix/asm_linux_arm.s +56 -0
  167. package/govendor/golang.org/x/sys/unix/asm_linux_arm64.s +50 -0
  168. package/govendor/golang.org/x/sys/unix/asm_linux_loong64.s +51 -0
  169. package/govendor/golang.org/x/sys/unix/asm_linux_mips64x.s +54 -0
  170. package/govendor/golang.org/x/sys/unix/asm_linux_mipsx.s +52 -0
  171. package/govendor/golang.org/x/sys/unix/asm_linux_ppc64x.s +42 -0
  172. package/govendor/golang.org/x/sys/unix/asm_linux_riscv64.s +47 -0
  173. package/govendor/golang.org/x/sys/unix/asm_linux_s390x.s +54 -0
  174. package/govendor/golang.org/x/sys/unix/asm_openbsd_mips64.s +29 -0
  175. package/govendor/golang.org/x/sys/unix/asm_solaris_amd64.s +17 -0
  176. package/govendor/golang.org/x/sys/unix/asm_zos_s390x.s +382 -0
  177. package/govendor/golang.org/x/sys/unix/auxv.go +36 -0
  178. package/govendor/golang.org/x/sys/unix/auxv_unsupported.go +13 -0
  179. package/govendor/golang.org/x/sys/unix/bluetooth_linux.go +36 -0
  180. package/govendor/golang.org/x/sys/unix/bpxsvc_zos.go +657 -0
  181. package/govendor/golang.org/x/sys/unix/bpxsvc_zos.s +192 -0
  182. package/govendor/golang.org/x/sys/unix/cap_freebsd.go +195 -0
  183. package/govendor/golang.org/x/sys/unix/constants.go +13 -0
  184. package/govendor/golang.org/x/sys/unix/dev_aix_ppc.go +26 -0
  185. package/govendor/golang.org/x/sys/unix/dev_aix_ppc64.go +28 -0
  186. package/govendor/golang.org/x/sys/unix/dev_darwin.go +24 -0
  187. package/govendor/golang.org/x/sys/unix/dev_dragonfly.go +30 -0
  188. package/govendor/golang.org/x/sys/unix/dev_freebsd.go +30 -0
  189. package/govendor/golang.org/x/sys/unix/dev_linux.go +42 -0
  190. package/govendor/golang.org/x/sys/unix/dev_netbsd.go +29 -0
  191. package/govendor/golang.org/x/sys/unix/dev_openbsd.go +29 -0
  192. package/govendor/golang.org/x/sys/unix/dev_zos.go +28 -0
  193. package/govendor/golang.org/x/sys/unix/dirent.go +102 -0
  194. package/govendor/golang.org/x/sys/unix/endian_big.go +9 -0
  195. package/govendor/golang.org/x/sys/unix/endian_little.go +9 -0
  196. package/govendor/golang.org/x/sys/unix/env_unix.go +31 -0
  197. package/govendor/golang.org/x/sys/unix/fcntl.go +36 -0
  198. package/govendor/golang.org/x/sys/unix/fcntl_darwin.go +24 -0
  199. package/govendor/golang.org/x/sys/unix/fcntl_linux_32bit.go +13 -0
  200. package/govendor/golang.org/x/sys/unix/fdset.go +27 -0
  201. package/govendor/golang.org/x/sys/unix/gccgo.go +59 -0
  202. package/govendor/golang.org/x/sys/unix/gccgo_c.c +44 -0
  203. package/govendor/golang.org/x/sys/unix/gccgo_linux_amd64.go +20 -0
  204. package/govendor/golang.org/x/sys/unix/ifreq_linux.go +145 -0
  205. package/govendor/golang.org/x/sys/unix/ioctl_linux.go +341 -0
  206. package/govendor/golang.org/x/sys/unix/ioctl_signed.go +74 -0
  207. package/govendor/golang.org/x/sys/unix/ioctl_unsigned.go +74 -0
  208. package/govendor/golang.org/x/sys/unix/ioctl_zos.go +71 -0
  209. package/govendor/golang.org/x/sys/unix/mkall.sh +250 -0
  210. package/govendor/golang.org/x/sys/unix/mkerrors.sh +807 -0
  211. package/govendor/golang.org/x/sys/unix/mmap_nomremap.go +13 -0
  212. package/govendor/golang.org/x/sys/unix/mremap.go +57 -0
  213. package/govendor/golang.org/x/sys/unix/pagesize_unix.go +15 -0
  214. package/govendor/golang.org/x/sys/unix/pledge_openbsd.go +111 -0
  215. package/govendor/golang.org/x/sys/unix/ptrace_darwin.go +11 -0
  216. package/govendor/golang.org/x/sys/unix/ptrace_ios.go +11 -0
  217. package/govendor/golang.org/x/sys/unix/race.go +30 -0
  218. package/govendor/golang.org/x/sys/unix/race0.go +25 -0
  219. package/govendor/golang.org/x/sys/unix/readdirent_getdents.go +12 -0
  220. package/govendor/golang.org/x/sys/unix/readdirent_getdirentries.go +19 -0
  221. package/govendor/golang.org/x/sys/unix/readv_unix.go +103 -0
  222. package/govendor/golang.org/x/sys/unix/sockcmsg_dragonfly.go +16 -0
  223. package/govendor/golang.org/x/sys/unix/sockcmsg_linux.go +85 -0
  224. package/govendor/golang.org/x/sys/unix/sockcmsg_unix.go +106 -0
  225. package/govendor/golang.org/x/sys/unix/sockcmsg_unix_other.go +46 -0
  226. package/govendor/golang.org/x/sys/unix/sockcmsg_zos.go +58 -0
  227. package/govendor/golang.org/x/sys/unix/symaddr_zos_s390x.s +75 -0
  228. package/govendor/golang.org/x/sys/unix/syscall.go +86 -0
  229. package/govendor/golang.org/x/sys/unix/syscall_aix.go +582 -0
  230. package/govendor/golang.org/x/sys/unix/syscall_aix_ppc.go +52 -0
  231. package/govendor/golang.org/x/sys/unix/syscall_aix_ppc64.go +83 -0
  232. package/govendor/golang.org/x/sys/unix/syscall_bsd.go +609 -0
  233. package/govendor/golang.org/x/sys/unix/syscall_darwin.go +711 -0
  234. package/govendor/golang.org/x/sys/unix/syscall_darwin_amd64.go +50 -0
  235. package/govendor/golang.org/x/sys/unix/syscall_darwin_arm64.go +50 -0
  236. package/govendor/golang.org/x/sys/unix/syscall_darwin_libSystem.go +26 -0
  237. package/govendor/golang.org/x/sys/unix/syscall_dragonfly.go +359 -0
  238. package/govendor/golang.org/x/sys/unix/syscall_dragonfly_amd64.go +56 -0
  239. package/govendor/golang.org/x/sys/unix/syscall_freebsd.go +455 -0
  240. package/govendor/golang.org/x/sys/unix/syscall_freebsd_386.go +64 -0
  241. package/govendor/golang.org/x/sys/unix/syscall_freebsd_amd64.go +64 -0
  242. package/govendor/golang.org/x/sys/unix/syscall_freebsd_arm.go +60 -0
  243. package/govendor/golang.org/x/sys/unix/syscall_freebsd_arm64.go +60 -0
  244. package/govendor/golang.org/x/sys/unix/syscall_freebsd_riscv64.go +60 -0
  245. package/govendor/golang.org/x/sys/unix/syscall_hurd.go +30 -0
  246. package/govendor/golang.org/x/sys/unix/syscall_hurd_386.go +28 -0
  247. package/govendor/golang.org/x/sys/unix/syscall_illumos.go +78 -0
  248. package/govendor/golang.org/x/sys/unix/syscall_linux.go +2574 -0
  249. package/govendor/golang.org/x/sys/unix/syscall_linux_386.go +313 -0
  250. package/govendor/golang.org/x/sys/unix/syscall_linux_alarm.go +12 -0
  251. package/govendor/golang.org/x/sys/unix/syscall_linux_amd64.go +144 -0
  252. package/govendor/golang.org/x/sys/unix/syscall_linux_amd64_gc.go +12 -0
  253. package/govendor/golang.org/x/sys/unix/syscall_linux_arm.go +218 -0
  254. package/govendor/golang.org/x/sys/unix/syscall_linux_arm64.go +188 -0
  255. package/govendor/golang.org/x/sys/unix/syscall_linux_gc.go +14 -0
  256. package/govendor/golang.org/x/sys/unix/syscall_linux_gc_386.go +16 -0
  257. package/govendor/golang.org/x/sys/unix/syscall_linux_gc_arm.go +13 -0
  258. package/govendor/golang.org/x/sys/unix/syscall_linux_gccgo_386.go +30 -0
  259. package/govendor/golang.org/x/sys/unix/syscall_linux_gccgo_arm.go +20 -0
  260. package/govendor/golang.org/x/sys/unix/syscall_linux_loong64.go +220 -0
  261. package/govendor/golang.org/x/sys/unix/syscall_linux_mips64x.go +187 -0
  262. package/govendor/golang.org/x/sys/unix/syscall_linux_mipsx.go +173 -0
  263. package/govendor/golang.org/x/sys/unix/syscall_linux_ppc.go +203 -0
  264. package/govendor/golang.org/x/sys/unix/syscall_linux_ppc64x.go +114 -0
  265. package/govendor/golang.org/x/sys/unix/syscall_linux_riscv64.go +193 -0
  266. package/govendor/golang.org/x/sys/unix/syscall_linux_s390x.go +295 -0
  267. package/govendor/golang.org/x/sys/unix/syscall_linux_sparc64.go +111 -0
  268. package/govendor/golang.org/x/sys/unix/syscall_netbsd.go +388 -0
  269. package/govendor/golang.org/x/sys/unix/syscall_netbsd_386.go +37 -0
  270. package/govendor/golang.org/x/sys/unix/syscall_netbsd_amd64.go +37 -0
  271. package/govendor/golang.org/x/sys/unix/syscall_netbsd_arm.go +37 -0
  272. package/govendor/golang.org/x/sys/unix/syscall_netbsd_arm64.go +37 -0
  273. package/govendor/golang.org/x/sys/unix/syscall_openbsd.go +346 -0
  274. package/govendor/golang.org/x/sys/unix/syscall_openbsd_386.go +41 -0
  275. package/govendor/golang.org/x/sys/unix/syscall_openbsd_amd64.go +41 -0
  276. package/govendor/golang.org/x/sys/unix/syscall_openbsd_arm.go +41 -0
  277. package/govendor/golang.org/x/sys/unix/syscall_openbsd_arm64.go +41 -0
  278. package/govendor/golang.org/x/sys/unix/syscall_openbsd_libc.go +26 -0
  279. package/govendor/golang.org/x/sys/unix/syscall_openbsd_mips64.go +39 -0
  280. package/govendor/golang.org/x/sys/unix/syscall_openbsd_ppc64.go +41 -0
  281. package/govendor/golang.org/x/sys/unix/syscall_openbsd_riscv64.go +41 -0
  282. package/govendor/golang.org/x/sys/unix/syscall_solaris.go +1183 -0
  283. package/govendor/golang.org/x/sys/unix/syscall_solaris_amd64.go +27 -0
  284. package/govendor/golang.org/x/sys/unix/syscall_unix.go +619 -0
  285. package/govendor/golang.org/x/sys/unix/syscall_unix_gc.go +14 -0
  286. package/govendor/golang.org/x/sys/unix/syscall_unix_gc_ppc64x.go +22 -0
  287. package/govendor/golang.org/x/sys/unix/syscall_zos_s390x.go +3213 -0
  288. package/govendor/golang.org/x/sys/unix/sysvshm_linux.go +20 -0
  289. package/govendor/golang.org/x/sys/unix/sysvshm_unix.go +51 -0
  290. package/govendor/golang.org/x/sys/unix/sysvshm_unix_other.go +13 -0
  291. package/govendor/golang.org/x/sys/unix/timestruct.go +76 -0
  292. package/govendor/golang.org/x/sys/unix/unveil_openbsd.go +51 -0
  293. package/govendor/golang.org/x/sys/unix/vgetrandom_linux.go +13 -0
  294. package/govendor/golang.org/x/sys/unix/vgetrandom_unsupported.go +11 -0
  295. package/govendor/golang.org/x/sys/unix/xattr_bsd.go +280 -0
  296. package/govendor/golang.org/x/sys/unix/zerrors_aix_ppc.go +1384 -0
  297. package/govendor/golang.org/x/sys/unix/zerrors_aix_ppc64.go +1385 -0
  298. package/govendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go +1922 -0
  299. package/govendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go +1922 -0
  300. package/govendor/golang.org/x/sys/unix/zerrors_dragonfly_amd64.go +1737 -0
  301. package/govendor/golang.org/x/sys/unix/zerrors_freebsd_386.go +2042 -0
  302. package/govendor/golang.org/x/sys/unix/zerrors_freebsd_amd64.go +2039 -0
  303. package/govendor/golang.org/x/sys/unix/zerrors_freebsd_arm.go +2033 -0
  304. package/govendor/golang.org/x/sys/unix/zerrors_freebsd_arm64.go +2033 -0
  305. package/govendor/golang.org/x/sys/unix/zerrors_freebsd_riscv64.go +2147 -0
  306. package/govendor/golang.org/x/sys/unix/zerrors_linux.go +4209 -0
  307. package/govendor/golang.org/x/sys/unix/zerrors_linux_386.go +882 -0
  308. package/govendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +882 -0
  309. package/govendor/golang.org/x/sys/unix/zerrors_linux_arm.go +887 -0
  310. package/govendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +884 -0
  311. package/govendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +874 -0
  312. package/govendor/golang.org/x/sys/unix/zerrors_linux_mips.go +888 -0
  313. package/govendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +888 -0
  314. package/govendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +888 -0
  315. package/govendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +888 -0
  316. package/govendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +940 -0
  317. package/govendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +944 -0
  318. package/govendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +944 -0
  319. package/govendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +884 -0
  320. package/govendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +943 -0
  321. package/govendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +992 -0
  322. package/govendor/golang.org/x/sys/unix/zerrors_netbsd_386.go +1779 -0
  323. package/govendor/golang.org/x/sys/unix/zerrors_netbsd_amd64.go +1769 -0
  324. package/govendor/golang.org/x/sys/unix/zerrors_netbsd_arm.go +1758 -0
  325. package/govendor/golang.org/x/sys/unix/zerrors_netbsd_arm64.go +1769 -0
  326. package/govendor/golang.org/x/sys/unix/zerrors_openbsd_386.go +1905 -0
  327. package/govendor/golang.org/x/sys/unix/zerrors_openbsd_amd64.go +1905 -0
  328. package/govendor/golang.org/x/sys/unix/zerrors_openbsd_arm.go +1905 -0
  329. package/govendor/golang.org/x/sys/unix/zerrors_openbsd_arm64.go +1905 -0
  330. package/govendor/golang.org/x/sys/unix/zerrors_openbsd_mips64.go +1905 -0
  331. package/govendor/golang.org/x/sys/unix/zerrors_openbsd_ppc64.go +1904 -0
  332. package/govendor/golang.org/x/sys/unix/zerrors_openbsd_riscv64.go +1903 -0
  333. package/govendor/golang.org/x/sys/unix/zerrors_solaris_amd64.go +1556 -0
  334. package/govendor/golang.org/x/sys/unix/zerrors_zos_s390x.go +990 -0
  335. package/govendor/golang.org/x/sys/unix/zptrace_armnn_linux.go +40 -0
  336. package/govendor/golang.org/x/sys/unix/zptrace_linux_arm64.go +17 -0
  337. package/govendor/golang.org/x/sys/unix/zptrace_mipsnn_linux.go +49 -0
  338. package/govendor/golang.org/x/sys/unix/zptrace_mipsnnle_linux.go +49 -0
  339. package/govendor/golang.org/x/sys/unix/zptrace_x86_linux.go +79 -0
  340. package/govendor/golang.org/x/sys/unix/zsymaddr_zos_s390x.s +364 -0
  341. package/govendor/golang.org/x/sys/unix/zsyscall_aix_ppc.go +1461 -0
  342. package/govendor/golang.org/x/sys/unix/zsyscall_aix_ppc64.go +1420 -0
  343. package/govendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gc.go +1188 -0
  344. package/govendor/golang.org/x/sys/unix/zsyscall_aix_ppc64_gccgo.go +1069 -0
  345. package/govendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +2728 -0
  346. package/govendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +799 -0
  347. package/govendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +2728 -0
  348. package/govendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +799 -0
  349. package/govendor/golang.org/x/sys/unix/zsyscall_dragonfly_amd64.go +1666 -0
  350. package/govendor/golang.org/x/sys/unix/zsyscall_freebsd_386.go +1886 -0
  351. package/govendor/golang.org/x/sys/unix/zsyscall_freebsd_amd64.go +1886 -0
  352. package/govendor/golang.org/x/sys/unix/zsyscall_freebsd_arm.go +1886 -0
  353. package/govendor/golang.org/x/sys/unix/zsyscall_freebsd_arm64.go +1886 -0
  354. package/govendor/golang.org/x/sys/unix/zsyscall_freebsd_riscv64.go +1886 -0
  355. package/govendor/golang.org/x/sys/unix/zsyscall_illumos_amd64.go +101 -0
  356. package/govendor/golang.org/x/sys/unix/zsyscall_linux.go +2267 -0
  357. package/govendor/golang.org/x/sys/unix/zsyscall_linux_386.go +469 -0
  358. package/govendor/golang.org/x/sys/unix/zsyscall_linux_amd64.go +636 -0
  359. package/govendor/golang.org/x/sys/unix/zsyscall_linux_arm.go +584 -0
  360. package/govendor/golang.org/x/sys/unix/zsyscall_linux_arm64.go +535 -0
  361. package/govendor/golang.org/x/sys/unix/zsyscall_linux_loong64.go +469 -0
  362. package/govendor/golang.org/x/sys/unix/zsyscall_linux_mips.go +636 -0
  363. package/govendor/golang.org/x/sys/unix/zsyscall_linux_mips64.go +630 -0
  364. package/govendor/golang.org/x/sys/unix/zsyscall_linux_mips64le.go +619 -0
  365. package/govendor/golang.org/x/sys/unix/zsyscall_linux_mipsle.go +636 -0
  366. package/govendor/golang.org/x/sys/unix/zsyscall_linux_ppc.go +641 -0
  367. package/govendor/golang.org/x/sys/unix/zsyscall_linux_ppc64.go +687 -0
  368. package/govendor/golang.org/x/sys/unix/zsyscall_linux_ppc64le.go +687 -0
  369. package/govendor/golang.org/x/sys/unix/zsyscall_linux_riscv64.go +531 -0
  370. package/govendor/golang.org/x/sys/unix/zsyscall_linux_s390x.go +478 -0
  371. package/govendor/golang.org/x/sys/unix/zsyscall_linux_sparc64.go +631 -0
  372. package/govendor/golang.org/x/sys/unix/zsyscall_netbsd_386.go +1848 -0
  373. package/govendor/golang.org/x/sys/unix/zsyscall_netbsd_amd64.go +1848 -0
  374. package/govendor/golang.org/x/sys/unix/zsyscall_netbsd_arm.go +1848 -0
  375. package/govendor/golang.org/x/sys/unix/zsyscall_netbsd_arm64.go +1848 -0
  376. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_386.go +2407 -0
  377. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_386.s +719 -0
  378. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.go +2407 -0
  379. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_amd64.s +719 -0
  380. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.go +2407 -0
  381. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_arm.s +719 -0
  382. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.go +2407 -0
  383. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_arm64.s +719 -0
  384. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.go +2407 -0
  385. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_mips64.s +719 -0
  386. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.go +2407 -0
  387. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_ppc64.s +862 -0
  388. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.go +2407 -0
  389. package/govendor/golang.org/x/sys/unix/zsyscall_openbsd_riscv64.s +719 -0
  390. package/govendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +2217 -0
  391. package/govendor/golang.org/x/sys/unix/zsyscall_zos_s390x.go +3458 -0
  392. package/govendor/golang.org/x/sys/unix/zsysctl_openbsd_386.go +280 -0
  393. package/govendor/golang.org/x/sys/unix/zsysctl_openbsd_amd64.go +280 -0
  394. package/govendor/golang.org/x/sys/unix/zsysctl_openbsd_arm.go +280 -0
  395. package/govendor/golang.org/x/sys/unix/zsysctl_openbsd_arm64.go +280 -0
  396. package/govendor/golang.org/x/sys/unix/zsysctl_openbsd_mips64.go +280 -0
  397. package/govendor/golang.org/x/sys/unix/zsysctl_openbsd_ppc64.go +280 -0
  398. package/govendor/golang.org/x/sys/unix/zsysctl_openbsd_riscv64.go +281 -0
  399. package/govendor/golang.org/x/sys/unix/zsysnum_darwin_amd64.go +439 -0
  400. package/govendor/golang.org/x/sys/unix/zsysnum_darwin_arm64.go +437 -0
  401. package/govendor/golang.org/x/sys/unix/zsysnum_dragonfly_amd64.go +316 -0
  402. package/govendor/golang.org/x/sys/unix/zsysnum_freebsd_386.go +393 -0
  403. package/govendor/golang.org/x/sys/unix/zsysnum_freebsd_amd64.go +393 -0
  404. package/govendor/golang.org/x/sys/unix/zsysnum_freebsd_arm.go +393 -0
  405. package/govendor/golang.org/x/sys/unix/zsysnum_freebsd_arm64.go +393 -0
  406. package/govendor/golang.org/x/sys/unix/zsysnum_freebsd_riscv64.go +393 -0
  407. package/govendor/golang.org/x/sys/unix/zsysnum_linux_386.go +470 -0
  408. package/govendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +394 -0
  409. package/govendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +434 -0
  410. package/govendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +337 -0
  411. package/govendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +334 -0
  412. package/govendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +454 -0
  413. package/govendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +384 -0
  414. package/govendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +384 -0
  415. package/govendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +454 -0
  416. package/govendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +461 -0
  417. package/govendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +433 -0
  418. package/govendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +433 -0
  419. package/govendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +338 -0
  420. package/govendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +399 -0
  421. package/govendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +413 -0
  422. package/govendor/golang.org/x/sys/unix/zsysnum_netbsd_386.go +274 -0
  423. package/govendor/golang.org/x/sys/unix/zsysnum_netbsd_amd64.go +274 -0
  424. package/govendor/golang.org/x/sys/unix/zsysnum_netbsd_arm.go +274 -0
  425. package/govendor/golang.org/x/sys/unix/zsysnum_netbsd_arm64.go +274 -0
  426. package/govendor/golang.org/x/sys/unix/zsysnum_openbsd_386.go +219 -0
  427. package/govendor/golang.org/x/sys/unix/zsysnum_openbsd_amd64.go +219 -0
  428. package/govendor/golang.org/x/sys/unix/zsysnum_openbsd_arm.go +219 -0
  429. package/govendor/golang.org/x/sys/unix/zsysnum_openbsd_arm64.go +218 -0
  430. package/govendor/golang.org/x/sys/unix/zsysnum_openbsd_mips64.go +221 -0
  431. package/govendor/golang.org/x/sys/unix/zsysnum_openbsd_ppc64.go +217 -0
  432. package/govendor/golang.org/x/sys/unix/zsysnum_openbsd_riscv64.go +218 -0
  433. package/govendor/golang.org/x/sys/unix/zsysnum_zos_s390x.go +2852 -0
  434. package/govendor/golang.org/x/sys/unix/ztypes_aix_ppc.go +353 -0
  435. package/govendor/golang.org/x/sys/unix/ztypes_aix_ppc64.go +357 -0
  436. package/govendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go +878 -0
  437. package/govendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go +878 -0
  438. package/govendor/golang.org/x/sys/unix/ztypes_dragonfly_amd64.go +473 -0
  439. package/govendor/golang.org/x/sys/unix/ztypes_freebsd_386.go +651 -0
  440. package/govendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go +656 -0
  441. package/govendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go +642 -0
  442. package/govendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go +636 -0
  443. package/govendor/golang.org/x/sys/unix/ztypes_freebsd_riscv64.go +638 -0
  444. package/govendor/golang.org/x/sys/unix/ztypes_linux.go +6547 -0
  445. package/govendor/golang.org/x/sys/unix/ztypes_linux_386.go +747 -0
  446. package/govendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +761 -0
  447. package/govendor/golang.org/x/sys/unix/ztypes_linux_arm.go +741 -0
  448. package/govendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +740 -0
  449. package/govendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +741 -0
  450. package/govendor/golang.org/x/sys/unix/ztypes_linux_mips.go +746 -0
  451. package/govendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +743 -0
  452. package/govendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +743 -0
  453. package/govendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +746 -0
  454. package/govendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +754 -0
  455. package/govendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +749 -0
  456. package/govendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +749 -0
  457. package/govendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +828 -0
  458. package/govendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +763 -0
  459. package/govendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +744 -0
  460. package/govendor/golang.org/x/sys/unix/ztypes_netbsd_386.go +585 -0
  461. package/govendor/golang.org/x/sys/unix/ztypes_netbsd_amd64.go +593 -0
  462. package/govendor/golang.org/x/sys/unix/ztypes_netbsd_arm.go +590 -0
  463. package/govendor/golang.org/x/sys/unix/ztypes_netbsd_arm64.go +593 -0
  464. package/govendor/golang.org/x/sys/unix/ztypes_openbsd_386.go +568 -0
  465. package/govendor/golang.org/x/sys/unix/ztypes_openbsd_amd64.go +568 -0
  466. package/govendor/golang.org/x/sys/unix/ztypes_openbsd_arm.go +575 -0
  467. package/govendor/golang.org/x/sys/unix/ztypes_openbsd_arm64.go +568 -0
  468. package/govendor/golang.org/x/sys/unix/ztypes_openbsd_mips64.go +568 -0
  469. package/govendor/golang.org/x/sys/unix/ztypes_openbsd_ppc64.go +570 -0
  470. package/govendor/golang.org/x/sys/unix/ztypes_openbsd_riscv64.go +570 -0
  471. package/govendor/golang.org/x/sys/unix/ztypes_solaris_amd64.go +516 -0
  472. package/govendor/golang.org/x/sys/unix/ztypes_zos_s390x.go +552 -0
  473. package/govendor/golang.org/x/sys/windows/aliases.go +13 -0
  474. package/govendor/golang.org/x/sys/windows/dll_windows.go +380 -0
  475. package/govendor/golang.org/x/sys/windows/env_windows.go +57 -0
  476. package/govendor/golang.org/x/sys/windows/eventlog.go +20 -0
  477. package/govendor/golang.org/x/sys/windows/exec_windows.go +248 -0
  478. package/govendor/golang.org/x/sys/windows/memory_windows.go +48 -0
  479. package/govendor/golang.org/x/sys/windows/mkerrors.bash +70 -0
  480. package/govendor/golang.org/x/sys/windows/mkknownfolderids.bash +27 -0
  481. package/govendor/golang.org/x/sys/windows/mksyscall.go +9 -0
  482. package/govendor/golang.org/x/sys/windows/race.go +30 -0
  483. package/govendor/golang.org/x/sys/windows/race0.go +25 -0
  484. package/govendor/golang.org/x/sys/windows/security_windows.go +1537 -0
  485. package/govendor/golang.org/x/sys/windows/service.go +257 -0
  486. package/govendor/golang.org/x/sys/windows/setupapi_windows.go +1425 -0
  487. package/govendor/golang.org/x/sys/windows/str.go +22 -0
  488. package/govendor/golang.org/x/sys/windows/syscall.go +104 -0
  489. package/govendor/golang.org/x/sys/windows/syscall_windows.go +1952 -0
  490. package/govendor/golang.org/x/sys/windows/types_windows.go +4058 -0
  491. package/govendor/golang.org/x/sys/windows/types_windows_386.go +35 -0
  492. package/govendor/golang.org/x/sys/windows/types_windows_amd64.go +34 -0
  493. package/govendor/golang.org/x/sys/windows/types_windows_arm.go +35 -0
  494. package/govendor/golang.org/x/sys/windows/types_windows_arm64.go +34 -0
  495. package/govendor/golang.org/x/sys/windows/zerrors_windows.go +9468 -0
  496. package/govendor/golang.org/x/sys/windows/zknownfolderids_windows.go +149 -0
  497. package/govendor/golang.org/x/sys/windows/zsyscall_windows.go +4828 -0
  498. package/govendor/manifest.txt +7 -0
  499. package/package.json +6 -1
  500. package/tsparser/main.go +37 -3
  501. package/tsparser/tsparser.exe +2 -2
  502. package/types/typenative-go.d.ts +15159 -5
  503. package/types/typenative-npm.d.ts +2637 -30
  504. package/types/typenative.d.ts +1092 -56
@@ -1,24 +1,29 @@
1
- // Type definitions for TypeNative
1
+ // Type definitions for TypeNative.
2
+ //
3
+ // Scaffolded projects compile with `lib: []` and `types: ["typenative", ...]`,
4
+ // so this file is the entire standard-library type surface: only declare what
5
+ // the transpiler actually lowers (see conformance.md for the feature matrix).
2
6
 
3
7
  interface Boolean {}
4
8
 
5
- interface CallableFunction extends Function {}
6
-
7
9
  interface Function {
8
- /* apply(thisArg: any, argArray?: any): any;
10
+ readonly name: string;
11
+ apply(thisArg: any, argArray?: any): any;
9
12
  call(thisArg: any, ...argArray: any[]): any;
10
- bind(thisArg: any, ...argArray: any[]): any; */
11
13
  }
12
14
 
15
+ interface CallableFunction extends Function {}
16
+ interface NewableFunction extends Function {}
17
+
13
18
  interface IArguments {
14
19
  [index: number]: any;
15
20
  length: number;
16
21
  }
17
22
 
18
- interface NewableFunction extends Function {}
19
-
20
23
  interface Number {
21
- toString(): string;
24
+ toString(radix?: number): string;
25
+ toFixed(fractionDigits?: number): string;
26
+ toPrecision(precision?: number): string;
22
27
  }
23
28
 
24
29
  interface Object {
@@ -26,22 +31,7 @@ interface Object {
26
31
  toString(): string;
27
32
  }
28
33
 
29
- interface RegExp {
30
- test(string: string): boolean;
31
- exec(string: string): string[] | null;
32
- }
33
-
34
- interface RegExpConstructor {
35
- new (pattern: string, flags?: string): RegExp;
36
- }
37
-
38
- declare var RegExp: RegExpConstructor;
39
-
40
- interface SymbolConstructor {
41
- readonly iterator: unique symbol;
42
- }
43
-
44
- declare var Symbol: SymbolConstructor;
34
+ // --- Iteration protocol (also unlocks for..of / spread over Map, Set, string) ---
45
35
 
46
36
  interface IteratorYieldResult<TYield> {
47
37
  done?: false;
@@ -56,16 +46,109 @@ interface IteratorReturnResult<TReturn> {
56
46
  type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
57
47
 
58
48
  interface Iterator<T, TReturn = any, TNext = any> {
59
- // NOTE: 'next' is defined using a tuple to ensure we report the correct assignability errors in all places.
60
49
  next(...[value]: [] | [TNext]): IteratorResult<T, TReturn>;
61
50
  return?(value?: TReturn): IteratorResult<T, TReturn>;
62
51
  throw?(e?: any): IteratorResult<T, TReturn>;
63
52
  }
64
53
 
65
- interface IterableIterator<T, TReturn = any, TNext = any> extends Iterator<T, TReturn, TNext> {
54
+ interface Iterable<T, TReturn = any, TNext = undefined> {
55
+ [Symbol.iterator](): Iterator<T, TReturn, TNext>;
56
+ }
57
+
58
+ interface IterableIterator<T, TReturn = any, TNext = undefined> extends Iterator<T, TReturn, TNext> {
66
59
  [Symbol.iterator](): IterableIterator<T, TReturn, TNext>;
67
60
  }
68
61
 
62
+ interface Generator<T = any, TReturn = any, TNext = any> extends Iterator<T, TReturn, TNext> {
63
+ [Symbol.iterator](): Generator<T, TReturn, TNext>;
64
+ }
65
+
66
+ interface AsyncIterator<T, TReturn = any, TNext = any> {
67
+ next(...[value]: [] | [TNext]): Promise<IteratorResult<T, TReturn>>;
68
+ return?(value?: TReturn): Promise<IteratorResult<T, TReturn>>;
69
+ throw?(e?: any): Promise<IteratorResult<T, TReturn>>;
70
+ }
71
+
72
+ interface AsyncIterable<T, TReturn = any, TNext = undefined> {
73
+ [Symbol.asyncIterator](): AsyncIterator<T, TReturn, TNext>;
74
+ }
75
+
76
+ interface AsyncIterableIterator<T, TReturn = any, TNext = undefined> extends AsyncIterator<T, TReturn, TNext> {
77
+ [Symbol.asyncIterator](): AsyncIterableIterator<T, TReturn, TNext>;
78
+ }
79
+
80
+ interface AsyncGenerator<T = any, TReturn = any, TNext = any> extends AsyncIterator<T, TReturn, TNext> {
81
+ [Symbol.asyncIterator](): AsyncGenerator<T, TReturn, TNext>;
82
+ }
83
+
84
+ // using x = r; / [Symbol.dispose]()
85
+ interface Disposable {
86
+ [Symbol.dispose](): void;
87
+ }
88
+
89
+ // await unwraps one thenable layer at a time
90
+ type Awaited<T> = T extends null | undefined
91
+ ? T
92
+ : T extends { then(onfulfilled: (value: infer U) => any): any }
93
+ ? Awaited<U>
94
+ : T;
95
+
96
+ // Tagged template functions: tag`a${x}b`
97
+ interface TemplateStringsArray {
98
+ readonly [index: number]: string;
99
+ readonly length: number;
100
+ readonly raw: readonly string[];
101
+ }
102
+
103
+ // Array.from(arrayLike, mapFn)
104
+ interface ArrayLike<T> {
105
+ length: number;
106
+ [n: number]: T;
107
+ }
108
+
109
+ // --- Utility types (lowered to the Go type of their first argument) ---
110
+
111
+ type Partial<T> = { [P in keyof T]?: T[P] };
112
+ type Required<T> = { [P in keyof T]-?: T[P] };
113
+ type Readonly<T> = { readonly [P in keyof T]: T[P] };
114
+ type Pick<T, K extends keyof T> = { [P in K]: T[P] };
115
+ type Omit<T, K extends keyof any> = { [P in keyof T as P extends K ? never : P]: T[P] };
116
+ type NonNullable<T> = T & {};
117
+ type Record<K extends keyof any, T> = { [P in K]: T };
118
+ type Parameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never;
119
+ type ReturnType<T extends (...args: any) => any> = T extends (...args: any) => infer R ? R : any;
120
+
121
+ // --- RegExp ---
122
+
123
+ interface RegExp {
124
+ lastIndex: number;
125
+ readonly source: string;
126
+ readonly flags: string;
127
+ readonly global: boolean;
128
+ readonly ignoreCase: boolean;
129
+ readonly multiline: boolean;
130
+ readonly dotAll: boolean;
131
+ readonly unicode: boolean;
132
+ readonly sticky: boolean;
133
+ test(string: string): boolean;
134
+ exec(string: string): RegExpExecArray | null;
135
+ }
136
+
137
+ // exec() result; named-group regexes carry a .groups record
138
+ interface RegExpExecArray extends Array<string> {
139
+ index: number;
140
+ readonly groups: Record<string, string> | undefined;
141
+ }
142
+
143
+ interface RegExpConstructor {
144
+ new (pattern: string | RegExp, flags?: string): RegExp;
145
+ (pattern: string | RegExp, flags?: string): RegExp;
146
+ }
147
+
148
+ declare var RegExp: RegExpConstructor;
149
+
150
+ // --- Array ---
151
+
69
152
  interface Array<T> extends IterableIterator<T> {
70
153
  /**
71
154
  * Gets or sets the length of the array. This is a number one higher than the highest index in the array.
@@ -74,7 +157,7 @@ interface Array<T> extends IterableIterator<T> {
74
157
  /**
75
158
  * Appends new elements to the end of an array.
76
159
  */
77
- push(element: T): void;
160
+ push(...items: T[]): number;
78
161
  /**
79
162
  * Adds all the elements of an array into a string, separated by the specified separator string.
80
163
  */
@@ -103,6 +186,14 @@ interface Array<T> extends IterableIterator<T> {
103
186
  * Returns the index of the first element that satisfies the callback, or -1.
104
187
  */
105
188
  findIndex(callback: (value: T, index?: number, array?: T[]) => boolean): number;
189
+ /**
190
+ * Returns the value of the last element where callback is true, and undefined otherwise.
191
+ */
192
+ findLast(callback: (value: T, index?: number, array?: T[]) => boolean): T | undefined;
193
+ /**
194
+ * Returns the index of the last element that satisfies the callback, or -1.
195
+ */
196
+ findLastIndex(callback: (value: T, index?: number, array?: T[]) => boolean): number;
106
197
  /**
107
198
  * Determines whether all elements satisfy the callback.
108
199
  */
@@ -119,10 +210,22 @@ interface Array<T> extends IterableIterator<T> {
119
210
  initialValue: U
120
211
  ): U;
121
212
  reduce(callback: (accumulator: T, value: T, index?: number, array?: T[]) => T): T;
213
+ /**
214
+ * Calls the callback function on each element of the array in reverse order, accumulating a result.
215
+ */
216
+ reduceRight<U>(
217
+ callback: (accumulator: U, value: T, index?: number, array?: T[]) => U,
218
+ initialValue: U
219
+ ): U;
220
+ reduceRight(callback: (accumulator: T, value: T, index?: number, array?: T[]) => T): T;
122
221
  /**
123
222
  * Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
124
223
  */
125
224
  indexOf(searchElement: T): number;
225
+ /**
226
+ * Returns the index of the last occurrence of a value in an array, or -1 if it is not present.
227
+ */
228
+ lastIndexOf(searchElement: T): number;
126
229
  /**
127
230
  * Determines whether an array includes a certain element.
128
231
  */
@@ -143,22 +246,55 @@ interface Array<T> extends IterableIterator<T> {
143
246
  * Reverses the elements of an array in place.
144
247
  */
145
248
  reverse(): T[];
249
+ /**
250
+ * Returns a reversed copy of the array.
251
+ */
252
+ toReversed(): T[];
146
253
  /**
147
254
  * Sorts the elements of an array in place.
148
255
  */
149
256
  sort(compareFn?: (a: T, b: T) => number): T[];
257
+ /**
258
+ * Returns a sorted copy of the array.
259
+ */
260
+ toSorted(compareFn?: (a: T, b: T) => number): T[];
261
+ /**
262
+ * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
263
+ */
264
+ splice(start: number, deleteCount?: number, ...items: T[]): T[];
265
+ /**
266
+ * Returns a spliced copy of the array.
267
+ */
268
+ toSpliced(start: number, deleteCount?: number, ...items: T[]): T[];
269
+ /**
270
+ * Returns a copy of the array with the element at the given index replaced.
271
+ */
272
+ with(index: number, value: T): T[];
150
273
  /**
151
274
  * Returns a new array formed by applying callback to each element and then flattening.
152
275
  */
153
276
  flat(): T[];
277
+ flatMap<U>(callback: (value: T, index?: number, array?: T[]) => U[]): U[];
278
+ /**
279
+ * Returns a copy of a section of an array with the fill value applied.
280
+ */
281
+ fill(value: T, start?: number, end?: number): T[];
282
+ /**
283
+ * Copies within the array in place (overlap-safe) and returns it.
284
+ */
285
+ copyWithin(target: number, start: number, end?: number): T[];
154
286
  /**
155
- * Merges two or more arrays.
287
+ * Merges two or more arrays (array arguments are flattened one level).
156
288
  */
157
- concat(...items: T[]): T[];
289
+ concat(...items: (T | T[])[]): T[];
158
290
  /**
159
291
  * Returns the element at the given index (supports negative indices).
160
292
  */
161
293
  at(index: number): T | undefined;
294
+ /**
295
+ * Returns [index, value] pairs, destructured by for...of.
296
+ */
297
+ entries(): IterableIterator<[number, T]>;
162
298
  /**
163
299
  * Returns a string representation of an array.
164
300
  */
@@ -167,13 +303,28 @@ interface Array<T> extends IterableIterator<T> {
167
303
  [n: number]: T;
168
304
  }
169
305
 
306
+ interface ArrayConstructor {
307
+ new <T>(length: number): T[];
308
+ isArray(arg: any): arg is any[];
309
+ from<T>(arrayLike: ArrayLike<T>): T[];
310
+ from<T, U>(arrayLike: ArrayLike<T>, mapFn: (value: T, index: number) => U): U[];
311
+ }
312
+
313
+ declare var Array: ArrayConstructor;
314
+
315
+ // --- String ---
316
+
170
317
  interface String {
171
318
  /** Returns the length of the string. */
172
319
  length: number;
173
320
  /** Returns the character at the specified index. */
174
321
  charAt(pos: number): string;
322
+ /** Returns the Unicode code point at the specified index. */
323
+ charCodeAt(pos: number): number;
175
324
  /** Returns the position of the first occurrence of a substring. */
176
- indexOf(searchString: string): number;
325
+ indexOf(searchString: string, position?: number): number;
326
+ /** Returns the position of the last occurrence of a substring. */
327
+ lastIndexOf(searchString: string): number;
177
328
  /** Determines whether a string contains the specified substring. */
178
329
  includes(searchString: string): boolean;
179
330
  /** Determines whether a string begins with the specified characters. */
@@ -181,7 +332,7 @@ interface String {
181
332
  /** Determines whether a string ends with the specified characters. */
182
333
  endsWith(searchString: string): boolean;
183
334
  /** Splits a string into substrings using the specified separator. */
184
- split(separator: string): string[];
335
+ split(separator: string | RegExp): string[];
185
336
  /** Removes whitespace from both ends of a string. */
186
337
  trim(): string;
187
338
  /** Removes whitespace from the beginning of a string. */
@@ -193,12 +344,13 @@ interface String {
193
344
  /** Converts all characters to lowercase. */
194
345
  toLowerCase(): string;
195
346
  /** Replaces the first occurrence of a substring. */
196
- replace(searchValue: string, replaceValue: string): string;
347
+ replace(searchValue: string | RegExp, replaceValue: string): string;
348
+ replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string;
197
349
  /** Replaces all occurrences of a substring. */
198
350
  replaceAll(searchValue: string, replaceValue: string): string;
199
351
  /** Returns a section of a string. */
200
352
  substring(start: number, end?: number): string;
201
- /** Returns a section of a string. */
353
+ /** Returns a section of a string (supports negative indices). */
202
354
  slice(start: number, end?: number): string;
203
355
  /** Returns a string repeated the specified number of times. */
204
356
  repeat(count: number): string;
@@ -214,37 +366,101 @@ interface String {
214
366
  matchAll(regexp: string | RegExp): string[][];
215
367
  /** Searches for a match and returns the index. */
216
368
  search(regexp: string | RegExp): number;
217
- /** Returns the element at the given index (supports negative indices). */
369
+ /** Returns the character at the given index (supports negative indices). */
218
370
  at(index: number): string | undefined;
371
+ /** Compares two strings (by code unit). */
372
+ localeCompare(that: string): number;
373
+ /** Returns the Unicode normalization of the string. */
374
+ normalize(form?: 'NFC' | 'NFD' | 'NFKC' | 'NFKD'): string;
219
375
  /** Returns a string representation. */
220
376
  toString(): string;
377
+ /** Iterates the string's characters ([...str] spreads runes). */
378
+ [Symbol.iterator](): IterableIterator<string>;
221
379
  [index: number]: string;
222
380
  }
223
381
 
382
+ interface StringConstructor {
383
+ (value?: any): string;
384
+ fromCharCode(...charCodes: number[]): string;
385
+ raw(strings: TemplateStringsArray, ...values: any[]): string;
386
+ }
387
+
388
+ declare var String: StringConstructor;
389
+
390
+ interface NumberConstructor {
391
+ (value?: any): number;
392
+ isNaN(value: number): boolean;
393
+ isFinite(value: number): boolean;
394
+ isInteger(value: number): boolean;
395
+ readonly MAX_SAFE_INTEGER: number;
396
+ readonly MIN_SAFE_INTEGER: number;
397
+ readonly MAX_VALUE: number;
398
+ readonly POSITIVE_INFINITY: number;
399
+ readonly EPSILON: number;
400
+ readonly NaN: number;
401
+ }
402
+
403
+ declare var Number: NumberConstructor;
404
+
405
+ // --- console / globals ---
406
+
224
407
  interface Console {
225
408
  log(...data: any[]): void;
409
+ info(...data: any[]): void;
410
+ debug(...data: any[]): void;
226
411
  error(...data: any[]): void;
412
+ warn(...data: any[]): void;
413
+ trace(...data: any[]): void;
414
+ dir(item?: any, options?: { depth?: number | null }): void;
415
+ assert(condition?: boolean, ...data: any[]): void;
416
+ count(label?: string): void;
417
+ countReset(label?: string): void;
418
+ table(tabularData: unknown, properties?: readonly string[]): void;
419
+ group(...label: any[]): void;
420
+ groupCollapsed(...label: any[]): void;
421
+ groupEnd(): void;
227
422
  time(label?: string): void;
228
423
  timeEnd(label?: string): void;
424
+ timeLog(label?: string, ...data: any[]): void;
229
425
  }
230
426
  declare var console: Console;
231
427
 
232
428
  interface Math {
429
+ readonly E: number;
430
+ readonly LN10: number;
431
+ readonly LN2: number;
432
+ readonly LOG10E: number;
433
+ readonly LOG2E: number;
434
+ readonly PI: number;
435
+ readonly SQRT1_2: number;
436
+ readonly SQRT2: number;
233
437
  random(): number;
234
438
  floor(x: number): number;
235
439
  ceil(x: number): number;
236
440
  round(x: number): number;
237
441
  abs(x: number): number;
238
- max(a: number, b: number): number;
239
- min(a: number, b: number): number;
442
+ max(...values: number[]): number;
443
+ min(...values: number[]): number;
240
444
  sqrt(x: number): number;
241
445
  pow(base: number, exponent: number): number;
242
446
  log(x: number): number;
243
447
  log2(x: number): number;
244
448
  log10(x: number): number;
449
+ log1p(x: number): number;
450
+ exp(x: number): number;
451
+ expm1(x: number): number;
245
452
  sin(x: number): number;
246
453
  cos(x: number): number;
247
454
  tan(x: number): number;
455
+ asin(x: number): number;
456
+ acos(x: number): number;
457
+ atan(x: number): number;
458
+ atan2(y: number, x: number): number;
459
+ sinh(x: number): number;
460
+ cosh(x: number): number;
461
+ tanh(x: number): number;
462
+ cbrt(x: number): number;
463
+ hypot(...values: number[]): number;
248
464
  trunc(x: number): number;
249
465
  sign(x: number): number;
250
466
  }
@@ -252,9 +468,39 @@ declare var Math: Math;
252
468
 
253
469
  declare function parseInt(s: string, radix?: number): number;
254
470
  declare function parseFloat(s: string): number;
255
- declare function String(value: any): string;
256
- declare function Number(value: any): number;
257
- declare function Boolean(value: any): boolean;
471
+ declare function Boolean(value?: any): boolean;
472
+ declare function isNaN(number: number): boolean;
473
+ declare function isFinite(number: number): boolean;
474
+ declare function encodeURIComponent(uriComponent: string): string;
475
+ declare function decodeURIComponent(uriComponent: string): string;
476
+ declare function structuredClone<T>(value: T): T;
477
+
478
+ // The running program (a native binary has no separate script file)
479
+ declare var __filename: string;
480
+ declare var __dirname: string;
481
+
482
+ declare var MessageChannel: typeof import('node:worker_threads').MessageChannel;
483
+ declare var MessagePort: typeof import('node:worker_threads').MessagePort;
484
+ declare var BroadcastChannel: typeof import('node:worker_threads').BroadcastChannel;
485
+
486
+ declare var NaN: number;
487
+ declare var Infinity: number;
488
+
489
+ // globalThis is the global scope itself: `globalThis.x` resolves the global x,
490
+ // `(globalThis as any).x` a dynamic property set.
491
+
492
+ interface ImportMeta {
493
+ readonly url: string;
494
+ }
495
+
496
+ // Timers and microtasks. Handles are opaque; pass them to the matching clear function.
497
+ declare function setTimeout(callback: (...args: any[]) => void, ms?: number): NodeJS.Timeout;
498
+ declare function clearTimeout(id?: NodeJS.Timeout | number): void;
499
+ declare function setInterval(callback: (...args: any[]) => void, ms?: number): NodeJS.Timeout;
500
+ declare function clearInterval(id?: NodeJS.Timeout | number): void;
501
+ declare function queueMicrotask(callback: () => void): void;
502
+
503
+ // --- JSON / Object / process ---
258
504
 
259
505
  interface JSON {
260
506
  stringify(value: any, replacer?: any, space?: number | string): string;
@@ -266,41 +512,200 @@ interface ObjectConstructor {
266
512
  keys(obj: any): string[];
267
513
  values(obj: any): any[];
268
514
  entries(obj: any): [string, any][];
515
+ assign(target: any, ...sources: any[]): any;
516
+ fromEntries(entries: Iterable<readonly [string, any]>): any;
517
+ hasOwn(obj: any, key: string): boolean;
518
+ defineProperty<T>(
519
+ obj: T,
520
+ key: string,
521
+ descriptor: { value: any; enumerable?: boolean; writable?: boolean; configurable?: boolean }
522
+ ): T;
523
+ getOwnPropertyNames(obj: any): string[];
524
+ freeze<T>(obj: T): T;
525
+ seal<T>(obj: T): T;
526
+ preventExtensions<T>(obj: T): T;
527
+ isFrozen(obj: any): boolean;
528
+ isSealed(obj: any): boolean;
529
+ isExtensible(obj: any): boolean;
269
530
  }
270
531
  declare var Object: ObjectConstructor;
271
532
 
272
533
  interface Process {
273
534
  argv: string[];
274
- platform: string;
535
+ readonly argv0: string;
536
+ readonly execArgv: string[];
537
+ readonly execPath: string;
538
+ readonly platform: string;
539
+ readonly arch: string;
540
+ readonly pid: number;
541
+ readonly ppid: number;
542
+ readonly version: string;
543
+ readonly versions: { readonly node: string; readonly [name: string]: string | undefined };
544
+ readonly title: string;
545
+ exitCode: number | undefined;
546
+ env: { [key: string]: string | undefined };
275
547
  exit(code?: number): never;
276
548
  cwd(): string;
277
- env: { [key: string]: string | undefined };
549
+ chdir(directory: string): void;
550
+ hrtime: { (time?: [number, number]): [number, number]; bigint(): bigint };
551
+ uptime(): number;
552
+ memoryUsage: {
553
+ (): { rss: number; heapTotal: number; heapUsed: number; external: number; arrayBuffers: number };
554
+ rss(): number;
555
+ };
556
+ nextTick<A extends any[]>(callback: (...args: A) => void, ...args: A): void;
557
+ kill(pid: number, signal?: string | number): true;
558
+ emitWarning(warning: string | Error): void;
559
+ getuid(): number;
560
+ getgid(): number;
561
+ geteuid(): number;
562
+ getegid(): number;
563
+ loadEnvFile(path?: string): void;
564
+ cpuUsage(previousValue?: { user: number; system: number }): { user: number; system: number };
565
+ resourceUsage(): {
566
+ userCPUTime: number;
567
+ systemCPUTime: number;
568
+ maxRSS: number;
569
+ sharedMemorySize: number;
570
+ unsharedDataSize: number;
571
+ unsharedStackSize: number;
572
+ minorPageFault: number;
573
+ majorPageFault: number;
574
+ swappedOut: number;
575
+ fsRead: number;
576
+ fsWrite: number;
577
+ ipcSent: number;
578
+ ipcReceived: number;
579
+ signalsCount: number;
580
+ voluntaryContextSwitches: number;
581
+ involuntaryContextSwitches: number;
582
+ };
583
+ availableMemory(): number;
584
+ constrainedMemory(): number;
585
+ on(event: 'uncaughtException' | 'uncaughtExceptionMonitor', listener: (error: Error, origin: 'uncaughtException' | 'unhandledRejection') => void): this;
586
+ on(event: 'unhandledRejection', listener: (reason: unknown, promise: Promise<unknown>) => void): this;
587
+ on(event: 'beforeExit', listener: (code: number) => void): this;
588
+ readonly stdout: import('node:stream').Writable & { readonly isTTY?: boolean; readonly fd: 1 };
589
+ readonly stderr: import('node:stream').Writable & { readonly isTTY?: boolean; readonly fd: 2 };
590
+ readonly stdin: import('node:stream').Readable & { readonly isTTY?: boolean; readonly fd: 0 };
591
+ on(event: 'exit', listener: (code: number) => void): this;
592
+ on(event: string, listener: (...args: any[]) => void): this;
593
+ once(event: 'exit', listener: (code: number) => void): this;
594
+ once(event: string, listener: (...args: any[]) => void): this;
595
+ addListener(event: string, listener: (...args: any[]) => void): this;
596
+ off(event: string, listener: (...args: any[]) => void): this;
597
+ removeListener(event: string, listener: (...args: any[]) => void): this;
598
+ emit(event: string, ...args: any[]): boolean;
599
+ listenerCount(event: string): number;
600
+ // IPC of forked children (child_process.fork, cluster workers)
601
+ send?(message: any, callback?: (error: Error | null) => void): boolean;
602
+ readonly connected: boolean;
603
+ disconnect(): void;
278
604
  }
279
605
  declare var process: Process;
280
606
 
281
- interface Promise<T> {
282
- then(callback: (value: T) => void): void;
607
+ // --- Error / Date ---
608
+
609
+ interface Error {
610
+ name: string;
611
+ message: string;
612
+ stack?: string;
613
+ cause?: unknown;
283
614
  }
284
615
 
285
- interface PromiseConstructor {
286
- new <T>(executor: (resolve: (value: T) => void) => void): Promise<T>;
616
+ interface ErrorOptions {
617
+ cause?: unknown;
287
618
  }
288
619
 
289
- declare var Promise: PromiseConstructor;
620
+ interface ErrorConstructor {
621
+ new (message?: string, options?: ErrorOptions): Error;
622
+ (message?: string, options?: ErrorOptions): Error;
623
+ }
290
624
 
291
- declare function setTimeout(callback: () => void, ms: number): void;
625
+ declare var Error: ErrorConstructor;
626
+ // Built-in Error subclasses: TnErrors carrying their name
627
+ declare var TypeError: ErrorConstructor;
628
+ declare var RangeError: ErrorConstructor;
629
+ declare var SyntaxError: ErrorConstructor;
630
+ declare var ReferenceError: ErrorConstructor;
631
+ declare var EvalError: ErrorConstructor;
632
+ declare var URIError: ErrorConstructor;
633
+ type TypeError = Error;
634
+ type RangeError = Error;
635
+ type SyntaxError = Error;
292
636
 
293
- declare function assert(condition: boolean, message?: string): void;
637
+ interface Date {
638
+ getTime(): number;
639
+ valueOf(): number;
640
+ getFullYear(): number;
641
+ getMonth(): number;
642
+ getDate(): number;
643
+ getDay(): number;
644
+ getHours(): number;
645
+ getMinutes(): number;
646
+ getSeconds(): number;
647
+ getMilliseconds(): number;
648
+ getUTCFullYear(): number;
649
+ getUTCMonth(): number;
650
+ getUTCDate(): number;
651
+ getUTCDay(): number;
652
+ getUTCHours(): number;
653
+ getUTCMinutes(): number;
654
+ getUTCSeconds(): number;
655
+ getUTCMilliseconds(): number;
656
+ toISOString(): string;
657
+ toJSON(): string;
658
+ toString(): string;
659
+ toDateString(): string;
660
+ toTimeString(): string;
661
+ }
294
662
 
295
- interface Error {
296
- message: string;
663
+ interface DateConstructor {
664
+ new (): Date;
665
+ new (ms: number): Date;
666
+ now(): number;
667
+ UTC(
668
+ year: number,
669
+ monthIndex: number,
670
+ date?: number,
671
+ hours?: number,
672
+ minutes?: number,
673
+ seconds?: number,
674
+ ms?: number
675
+ ): number;
297
676
  }
298
677
 
299
- interface ErrorConstructor {
300
- new (message?: string): Error;
678
+ declare var Date: DateConstructor;
679
+
680
+ // --- Promise (lowered to goroutines over channels) ---
681
+
682
+ interface Promise<T> {
683
+ then(onfulfilled?: (value: T) => any): void;
684
+ catch(onrejected?: (reason: any) => any): Promise<T>;
685
+ finally(onfinally?: () => void): Promise<T>;
301
686
  }
302
687
 
303
- declare var Error: ErrorConstructor;
688
+ // Thenables (needed by the compiler for async callbacks passed to generic APIs)
689
+ interface PromiseLike<T> {
690
+ then(onfulfilled?: (value: T) => any): any;
691
+ }
692
+
693
+ interface PromiseConstructor {
694
+ new <T>(
695
+ executor: (resolve: (value: T) => void, reject?: (reason?: any) => void) => void
696
+ ): Promise<T>;
697
+ resolve(): Promise<void>;
698
+ resolve<T>(value: T): Promise<T>;
699
+ reject(reason?: any): Promise<never>;
700
+ all<T>(values: Promise<T>[]): Promise<T[]>;
701
+ race<T>(values: Promise<T>[]): Promise<T>;
702
+ any<T>(values: Promise<T>[]): Promise<T>;
703
+ allSettled<T>(values: Promise<T>[]): Promise<{ status: string; value?: T; reason?: any }[]>;
704
+ }
705
+
706
+ declare var Promise: PromiseConstructor;
707
+
708
+ // --- Map / Set / WeakMap / WeakSet (ordered Go maps) ---
304
709
 
305
710
  interface Map<K, V> {
306
711
  /** The number of key/value pairs in the Map. */
@@ -315,7 +720,14 @@ interface Map<K, V> {
315
720
  delete(key: K): boolean;
316
721
  /** Removes all entries. */
317
722
  clear(): void;
318
- [Symbol.iterator](): Iterator<[K, V]>;
723
+ /** Performs the callback for each entry in insertion order. */
724
+ forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void): void;
725
+ /** The keys, in insertion order. */
726
+ keys(): K[];
727
+ /** The values, in insertion order. */
728
+ values(): V[];
729
+ /** Iterates [key, value] pairs in insertion order. */
730
+ [Symbol.iterator](): IterableIterator<[K, V]>;
319
731
  }
320
732
 
321
733
  interface MapConstructor {
@@ -336,12 +748,636 @@ interface Set<T> {
336
748
  delete(value: T): boolean;
337
749
  /** Removes all values. */
338
750
  clear(): void;
339
- [Symbol.iterator](): Iterator<T>;
751
+ /** Performs the callback for each value in insertion order. */
752
+ forEach(callbackfn: (value: T, value2: T, set: Set<T>) => void): void;
753
+ /** The values, in insertion order. */
754
+ values(): T[];
755
+ union(other: Set<T>): Set<T>;
756
+ intersection(other: Set<T>): Set<T>;
757
+ difference(other: Set<T>): Set<T>;
758
+ symmetricDifference(other: Set<T>): Set<T>;
759
+ isSubsetOf(other: Set<T>): boolean;
760
+ isSupersetOf(other: Set<T>): boolean;
761
+ isDisjointFrom(other: Set<T>): boolean;
762
+ /** Iterates the values in insertion order. */
763
+ [Symbol.iterator](): IterableIterator<T>;
340
764
  }
341
765
 
342
766
  interface SetConstructor {
343
767
  new <T>(): Set<T>;
344
- new <T>(values: T[]): Set<T>;
768
+ new <T>(values?: T[] | Set<T>): Set<T>;
345
769
  }
346
770
 
347
771
  declare var Set: SetConstructor;
772
+
773
+ // WeakMap/WeakSet lower to Map/Set with the same API; weakness is not observable.
774
+ interface WeakMap<K extends object, V> {
775
+ set(key: K, value: V): this;
776
+ get(key: K): V | undefined;
777
+ has(key: K): boolean;
778
+ delete(key: K): boolean;
779
+ }
780
+
781
+ interface WeakMapConstructor {
782
+ new <K extends object, V>(): WeakMap<K, V>;
783
+ new <K extends object, V>(entries?: [K, V][]): WeakMap<K, V>;
784
+ }
785
+
786
+ declare var WeakMap: WeakMapConstructor;
787
+
788
+ interface WeakSet<T extends object> {
789
+ add(value: T): this;
790
+ has(value: T): boolean;
791
+ delete(value: T): boolean;
792
+ }
793
+
794
+ interface WeakSetConstructor {
795
+ new <T extends object>(): WeakSet<T>;
796
+ new <T extends object>(values?: T[]): WeakSet<T>;
797
+ }
798
+
799
+ declare var WeakSet: WeakSetConstructor;
800
+
801
+ // --- Symbol ---
802
+
803
+ interface SymbolConstructor {
804
+ (description?: string | number): symbol;
805
+ readonly iterator: unique symbol;
806
+ readonly asyncIterator: unique symbol;
807
+ readonly dispose: unique symbol;
808
+ }
809
+
810
+ declare var Symbol: SymbolConstructor;
811
+
812
+ // --- Decorators (class and class-method decorators are lowered) ---
813
+
814
+ interface ClassDecoratorContext<Class extends abstract new (...args: any) => any = abstract new (...args: any) => any> {
815
+ readonly kind: 'class';
816
+ readonly name: string | undefined;
817
+ addInitializer(initializer: (this: Class) => void): void;
818
+ }
819
+
820
+ interface ClassMethodDecoratorContext<
821
+ This = unknown,
822
+ Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any,
823
+ > {
824
+ readonly kind: 'method';
825
+ readonly name: string | symbol;
826
+ readonly static: boolean;
827
+ readonly private: boolean;
828
+ readonly access: {
829
+ has(object: This): boolean;
830
+ get(object: This): Value;
831
+ };
832
+ addInitializer(initializer: (this: This) => void): void;
833
+ }
834
+
835
+ // bigint values (*big.Int): toString(radix)
836
+ interface BigInt {
837
+ toString(radix?: number): string;
838
+ }
839
+
840
+ // --- Node.js globals (Buffer, URL, TextEncoder, AbortController, performance, …) ---
841
+
842
+ type BufferEncoding =
843
+ | 'ascii'
844
+ | 'utf8'
845
+ | 'utf-8'
846
+ | 'utf16le'
847
+ | 'utf-16le'
848
+ | 'ucs2'
849
+ | 'ucs-2'
850
+ | 'base64'
851
+ | 'base64url'
852
+ | 'latin1'
853
+ | 'binary'
854
+ | 'hex';
855
+
856
+ // Byte arrays: Uint8Array and Buffer are Go []byte (slices share memory)
857
+ interface Uint8Array {
858
+ readonly length: number;
859
+ readonly byteLength: number;
860
+ [index: number]: number;
861
+ subarray(start?: number, end?: number): Uint8Array;
862
+ slice(start?: number, end?: number): Uint8Array;
863
+ set(array: ArrayLike<number>, offset?: number): void;
864
+ at(index: number): number | undefined;
865
+ [Symbol.iterator](): IterableIterator<number>;
866
+ }
867
+
868
+ interface Uint8ArrayConstructor {
869
+ new (length: number): Uint8Array;
870
+ new (array: ArrayLike<number> | Uint8Array): Uint8Array;
871
+ from(arrayLike: ArrayLike<number> | Iterable<number>): Uint8Array;
872
+ }
873
+
874
+ declare var Uint8Array: Uint8ArrayConstructor;
875
+
876
+ // hkdfSync returns key bytes (an ArrayBuffer in Node); wrap with Buffer.from
877
+ interface ArrayBuffer {
878
+ readonly byteLength: number;
879
+ }
880
+
881
+ interface Buffer extends Uint8Array {
882
+ toString(encoding?: BufferEncoding, start?: number, end?: number): string;
883
+ toJSON(): { type: 'Buffer'; data: number[] };
884
+ equals(otherBuffer: Uint8Array): boolean;
885
+ compare(otherBuffer: Uint8Array): number;
886
+ subarray(start?: number, end?: number): Buffer;
887
+ slice(start?: number, end?: number): Buffer;
888
+ indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
889
+ lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
890
+ includes(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): boolean;
891
+ fill(value: string | number | Uint8Array, offset?: number, end?: number): this;
892
+ fill(value: string, encoding: BufferEncoding): this;
893
+ write(string: string, offset?: number, length?: number, encoding?: BufferEncoding): number;
894
+ write(string: string, encoding: BufferEncoding): number;
895
+ copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
896
+ readUInt8(offset?: number): number;
897
+ readUint8(offset?: number): number;
898
+ readUInt16LE(offset?: number): number;
899
+ readUint16LE(offset?: number): number;
900
+ readUInt16BE(offset?: number): number;
901
+ readUint16BE(offset?: number): number;
902
+ readUInt32LE(offset?: number): number;
903
+ readUint32LE(offset?: number): number;
904
+ readUInt32BE(offset?: number): number;
905
+ readUint32BE(offset?: number): number;
906
+ readInt8(offset?: number): number;
907
+ readInt16LE(offset?: number): number;
908
+ readInt16BE(offset?: number): number;
909
+ readInt32LE(offset?: number): number;
910
+ readInt32BE(offset?: number): number;
911
+ readFloatLE(offset?: number): number;
912
+ readFloatBE(offset?: number): number;
913
+ readDoubleLE(offset?: number): number;
914
+ readDoubleBE(offset?: number): number;
915
+ writeUInt8(value: number, offset?: number): number;
916
+ writeUint8(value: number, offset?: number): number;
917
+ writeUInt16LE(value: number, offset?: number): number;
918
+ writeUint16LE(value: number, offset?: number): number;
919
+ writeUInt16BE(value: number, offset?: number): number;
920
+ writeUint16BE(value: number, offset?: number): number;
921
+ writeUInt32LE(value: number, offset?: number): number;
922
+ writeUint32LE(value: number, offset?: number): number;
923
+ writeUInt32BE(value: number, offset?: number): number;
924
+ writeUint32BE(value: number, offset?: number): number;
925
+ writeInt8(value: number, offset?: number): number;
926
+ writeInt16LE(value: number, offset?: number): number;
927
+ writeInt16BE(value: number, offset?: number): number;
928
+ writeInt32LE(value: number, offset?: number): number;
929
+ writeInt32BE(value: number, offset?: number): number;
930
+ writeFloatLE(value: number, offset?: number): number;
931
+ writeFloatBE(value: number, offset?: number): number;
932
+ writeDoubleLE(value: number, offset?: number): number;
933
+ writeDoubleBE(value: number, offset?: number): number;
934
+ readBigInt64LE(offset?: number): bigint;
935
+ readBigInt64BE(offset?: number): bigint;
936
+ readBigUInt64LE(offset?: number): bigint;
937
+ readBigUInt64BE(offset?: number): bigint;
938
+ readBigUint64LE(offset?: number): bigint;
939
+ readBigUint64BE(offset?: number): bigint;
940
+ writeBigInt64LE(value: bigint, offset?: number): number;
941
+ writeBigInt64BE(value: bigint, offset?: number): number;
942
+ writeBigUInt64LE(value: bigint, offset?: number): number;
943
+ writeBigUInt64BE(value: bigint, offset?: number): number;
944
+ writeBigUint64LE(value: bigint, offset?: number): number;
945
+ writeBigUint64BE(value: bigint, offset?: number): number;
946
+ swap16(): Buffer;
947
+ swap32(): Buffer;
948
+ swap64(): Buffer;
949
+ }
950
+
951
+ interface BufferConstructor {
952
+ from(data: string, encoding?: BufferEncoding): Buffer;
953
+ from(data: ArrayLike<number> | Uint8Array | ArrayBuffer): Buffer;
954
+ alloc(size: number, fill?: string | number | Uint8Array, encoding?: BufferEncoding): Buffer;
955
+ allocUnsafe(size: number): Buffer;
956
+ allocUnsafeSlow(size: number): Buffer;
957
+ concat(list: readonly Uint8Array[], totalLength?: number): Buffer;
958
+ byteLength(string: string | Uint8Array, encoding?: BufferEncoding): number;
959
+ isBuffer(obj: any): obj is Buffer;
960
+ isEncoding(encoding: string): encoding is BufferEncoding;
961
+ compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1;
962
+ }
963
+
964
+ declare var Buffer: BufferConstructor;
965
+
966
+ declare function atob(data: string): string;
967
+ declare function btoa(data: string): string;
968
+
969
+ interface TextEncoder {
970
+ readonly encoding: string;
971
+ encode(input?: string): Uint8Array;
972
+ }
973
+ declare var TextEncoder: { new (): TextEncoder };
974
+
975
+ interface TextDecoder {
976
+ readonly encoding: string;
977
+ decode(input?: Uint8Array, options?: { stream?: boolean }): string;
978
+ }
979
+ declare var TextDecoder: { new (label?: string): TextDecoder };
980
+
981
+ interface URLSearchParams extends Iterable<[string, string]> {
982
+ readonly size: number;
983
+ append(name: string, value: string): void;
984
+ delete(name: string, value?: string): void;
985
+ get(name: string): string | null;
986
+ getAll(name: string): string[];
987
+ has(name: string, value?: string): boolean;
988
+ set(name: string, value: string): void;
989
+ sort(): void;
990
+ toString(): string;
991
+ forEach(callback: (value: string, key: string, parent: URLSearchParams) => void): void;
992
+ keys(): IterableIterator<string>;
993
+ values(): IterableIterator<string>;
994
+ entries(): IterableIterator<[string, string]>;
995
+ [Symbol.iterator](): IterableIterator<[string, string]>;
996
+ }
997
+ declare var URLSearchParams: {
998
+ new (init?: string | Record<string, string> | readonly (readonly [string, string])[] | URLSearchParams): URLSearchParams;
999
+ };
1000
+
1001
+ interface URL {
1002
+ href: string;
1003
+ protocol: string;
1004
+ username: string;
1005
+ password: string;
1006
+ host: string;
1007
+ hostname: string;
1008
+ port: string;
1009
+ pathname: string;
1010
+ search: string;
1011
+ hash: string;
1012
+ readonly origin: string;
1013
+ readonly searchParams: URLSearchParams;
1014
+ toString(): string;
1015
+ toJSON(): string;
1016
+ }
1017
+ declare var URL: {
1018
+ new (input: string | URL, base?: string | URL): URL;
1019
+ canParse(input: string, base?: string): boolean;
1020
+ parse(input: string, base?: string): URL | null;
1021
+ };
1022
+
1023
+ interface Event {
1024
+ readonly type: string;
1025
+ readonly defaultPrevented: boolean;
1026
+ readonly target: any;
1027
+ readonly timeStamp: number;
1028
+ preventDefault(): void;
1029
+ }
1030
+ declare var Event: { new (type: string, options?: { cancelable?: boolean }): Event };
1031
+
1032
+ interface EventTarget {
1033
+ addEventListener(type: string, listener: (event: Event) => void, options?: { once?: boolean }): void;
1034
+ removeEventListener(type: string, listener: (event: Event) => void): void;
1035
+ dispatchEvent(event: Event): boolean;
1036
+ }
1037
+ declare var EventTarget: { new (): EventTarget };
1038
+
1039
+ interface AbortSignal extends EventTarget {
1040
+ readonly aborted: boolean;
1041
+ readonly reason: any;
1042
+ onabort: ((event: Event) => void) | null;
1043
+ throwIfAborted(): void;
1044
+ }
1045
+ declare var AbortSignal: {
1046
+ abort(reason?: any): AbortSignal;
1047
+ timeout(milliseconds: number): AbortSignal;
1048
+ any(signals: AbortSignal[]): AbortSignal;
1049
+ };
1050
+
1051
+ interface AbortController {
1052
+ readonly signal: AbortSignal;
1053
+ abort(reason?: any): void;
1054
+ }
1055
+ declare var AbortController: { new (): AbortController };
1056
+
1057
+ interface PerformanceEntry {
1058
+ readonly name: string;
1059
+ readonly entryType: string;
1060
+ readonly startTime: number;
1061
+ readonly duration: number;
1062
+ readonly detail?: any;
1063
+ }
1064
+ interface PerformanceObserverEntryList {
1065
+ getEntries(): PerformanceEntry[];
1066
+ getEntriesByName(name: string, type?: string): PerformanceEntry[];
1067
+ getEntriesByType(type: string): PerformanceEntry[];
1068
+ }
1069
+ interface PerformanceObserver {
1070
+ observe(options: { entryTypes: readonly string[] } | { type: string; buffered?: boolean }): void;
1071
+ disconnect(): void;
1072
+ takeRecords(): PerformanceEntry[];
1073
+ }
1074
+ declare var PerformanceObserver: {
1075
+ new (callback: (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void): PerformanceObserver;
1076
+ readonly supportedEntryTypes: readonly string[];
1077
+ };
1078
+ interface Performance {
1079
+ timerify<T extends (...params: any[]) => any>(fn: T): T;
1080
+ eventLoopUtilization(previous?: { idle: number; active: number; utilization: number }): { idle: number; active: number; utilization: number };
1081
+ readonly timeOrigin: number;
1082
+ now(): number;
1083
+ mark(name: string, options?: { startTime?: number; detail?: any }): PerformanceEntry;
1084
+ measure(name: string, startMark?: string, endMark?: string): PerformanceEntry;
1085
+ measure(name: string, options: { start?: string; end?: string }): PerformanceEntry;
1086
+ getEntries(): PerformanceEntry[];
1087
+ getEntriesByName(name: string, type?: string): PerformanceEntry[];
1088
+ getEntriesByType(type: string): PerformanceEntry[];
1089
+ clearMarks(name?: string): void;
1090
+ clearMeasures(name?: string): void;
1091
+ }
1092
+ declare var performance: Performance;
1093
+
1094
+ declare var crypto: {
1095
+ randomUUID(): string;
1096
+ getRandomValues<T extends Uint8Array>(array: T): T;
1097
+ readonly subtle: import('node:crypto').webcrypto.SubtleCrypto;
1098
+ };
1099
+ type CryptoKey = import('node:crypto').webcrypto.CryptoKey;
1100
+
1101
+ // --- Web streams (node:stream/web globals) ---
1102
+
1103
+ interface ReadableStreamReadResult<R> {
1104
+ done: boolean;
1105
+ value: R;
1106
+ }
1107
+ interface ReadableStreamDefaultController<R = any> {
1108
+ readonly desiredSize: number | null;
1109
+ enqueue(chunk?: R): void;
1110
+ close(): void;
1111
+ error(e?: any): void;
1112
+ }
1113
+ interface UnderlyingSource<R = any> {
1114
+ type?: 'bytes';
1115
+ start?(controller: ReadableStreamDefaultController<R>): any;
1116
+ pull?(controller: ReadableStreamDefaultController<R>): void | PromiseLike<void>;
1117
+ cancel?(reason?: any): void | PromiseLike<void>;
1118
+ }
1119
+ interface QueuingStrategy<T = any> {
1120
+ highWaterMark?: number;
1121
+ size?(chunk: T): number;
1122
+ }
1123
+ interface ReadableStreamDefaultReader<R = any> {
1124
+ readonly closed: Promise<void>;
1125
+ read(): Promise<ReadableStreamReadResult<R>>;
1126
+ releaseLock(): void;
1127
+ cancel(reason?: any): Promise<void>;
1128
+ }
1129
+ interface StreamPipeOptions {
1130
+ preventAbort?: boolean;
1131
+ preventCancel?: boolean;
1132
+ preventClose?: boolean;
1133
+ signal?: AbortSignal;
1134
+ }
1135
+ interface ReadableWritablePair<R = any, W = any> {
1136
+ readable: ReadableStream<R>;
1137
+ writable: WritableStream<W>;
1138
+ }
1139
+ interface ReadableStream<R = any> extends AsyncIterable<R> {
1140
+ readonly locked: boolean;
1141
+ getReader(options?: { mode?: undefined }): ReadableStreamDefaultReader<R>;
1142
+ cancel(reason?: any): Promise<void>;
1143
+ tee(): [ReadableStream<R>, ReadableStream<R>];
1144
+ pipeTo(destination: WritableStream<R>, options?: StreamPipeOptions): Promise<void>;
1145
+ pipeThrough<T>(transform: ReadableWritablePair<T, R>, options?: StreamPipeOptions): ReadableStream<T>;
1146
+ values(options?: { preventCancel?: boolean }): AsyncIterableIterator<R>;
1147
+ [Symbol.asyncIterator](): AsyncIterableIterator<R>;
1148
+ }
1149
+ declare var ReadableStream: {
1150
+ new <R = any>(underlyingSource?: UnderlyingSource<R>, strategy?: QueuingStrategy<R>): ReadableStream<R>;
1151
+ from<T>(iterable: Iterable<T> | AsyncIterable<T>): ReadableStream<T>;
1152
+ };
1153
+ declare var ReadableStreamDefaultReader: { new <R = any>(stream: ReadableStream<R>): ReadableStreamDefaultReader<R> };
1154
+
1155
+ interface WritableStreamDefaultController {
1156
+ readonly signal: AbortSignal;
1157
+ error(e?: any): void;
1158
+ }
1159
+ interface UnderlyingSink<W = any> {
1160
+ start?(controller: WritableStreamDefaultController): any;
1161
+ write?(chunk: W, controller: WritableStreamDefaultController): void | PromiseLike<void>;
1162
+ close?(): void | PromiseLike<void>;
1163
+ abort?(reason?: any): void | PromiseLike<void>;
1164
+ }
1165
+ interface WritableStreamDefaultWriter<W = any> {
1166
+ readonly closed: Promise<void>;
1167
+ readonly ready: Promise<void>;
1168
+ readonly desiredSize: number | null;
1169
+ write(chunk?: W): Promise<void>;
1170
+ close(): Promise<void>;
1171
+ abort(reason?: any): Promise<void>;
1172
+ releaseLock(): void;
1173
+ }
1174
+ interface WritableStream<W = any> {
1175
+ readonly locked: boolean;
1176
+ getWriter(): WritableStreamDefaultWriter<W>;
1177
+ close(): Promise<void>;
1178
+ abort(reason?: any): Promise<void>;
1179
+ }
1180
+ declare var WritableStream: { new <W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W> };
1181
+ declare var WritableStreamDefaultWriter: { new <W = any>(stream: WritableStream<W>): WritableStreamDefaultWriter<W> };
1182
+
1183
+ interface TransformStreamDefaultController<O = any> {
1184
+ readonly desiredSize: number | null;
1185
+ enqueue(chunk?: O): void;
1186
+ error(reason?: any): void;
1187
+ terminate(): void;
1188
+ }
1189
+ interface Transformer<I = any, O = any> {
1190
+ start?(controller: TransformStreamDefaultController<O>): any;
1191
+ transform?(chunk: I, controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
1192
+ flush?(controller: TransformStreamDefaultController<O>): void | PromiseLike<void>;
1193
+ cancel?(reason?: any): void | PromiseLike<void>;
1194
+ }
1195
+ interface TransformStream<I = any, O = any> {
1196
+ readonly readable: ReadableStream<O>;
1197
+ readonly writable: WritableStream<I>;
1198
+ }
1199
+ declare var TransformStream: {
1200
+ new <I = any, O = any>(transformer?: Transformer<I, O>, writableStrategy?: QueuingStrategy<I>, readableStrategy?: QueuingStrategy<O>): TransformStream<I, O>;
1201
+ };
1202
+
1203
+ interface TextEncoderStream extends TransformStream<string, Uint8Array> {
1204
+ readonly encoding: 'utf-8';
1205
+ }
1206
+ declare var TextEncoderStream: { new (): TextEncoderStream };
1207
+ interface TextDecoderStream extends TransformStream<Uint8Array, string> {
1208
+ readonly encoding: string;
1209
+ readonly fatal: boolean;
1210
+ readonly ignoreBOM: boolean;
1211
+ }
1212
+ declare var TextDecoderStream: { new (label?: string, options?: { fatal?: boolean; ignoreBOM?: boolean }): TextDecoderStream };
1213
+ type CompressionFormat = 'deflate' | 'deflate-raw' | 'gzip';
1214
+ interface CompressionStream extends TransformStream<Uint8Array, Uint8Array> {}
1215
+ declare var CompressionStream: { new (format: CompressionFormat): CompressionStream };
1216
+ interface DecompressionStream extends TransformStream<Uint8Array, Uint8Array> {}
1217
+ declare var DecompressionStream: { new (format: CompressionFormat): DecompressionStream };
1218
+
1219
+ interface CountQueuingStrategy extends QueuingStrategy {
1220
+ readonly highWaterMark: number;
1221
+ size(chunk?: any): 1;
1222
+ }
1223
+ declare var CountQueuingStrategy: { new (init: { highWaterMark: number }): CountQueuingStrategy };
1224
+ interface ByteLengthQueuingStrategy extends QueuingStrategy<Uint8Array> {
1225
+ readonly highWaterMark: number;
1226
+ size(chunk: Uint8Array): number;
1227
+ }
1228
+ declare var ByteLengthQueuingStrategy: { new (init: { highWaterMark: number }): ByteLengthQueuingStrategy };
1229
+
1230
+ // --- Blob / File / FormData ---
1231
+
1232
+ type BlobPart = string | Uint8Array | Blob;
1233
+ interface Blob {
1234
+ readonly size: number;
1235
+ readonly type: string;
1236
+ text(): Promise<string>;
1237
+ bytes(): Promise<Uint8Array>;
1238
+ arrayBuffer(): Promise<Uint8Array>;
1239
+ slice(start?: number, end?: number, contentType?: string): Blob;
1240
+ stream(): ReadableStream<Uint8Array>;
1241
+ }
1242
+ declare var Blob: { new (blobParts?: BlobPart[], options?: { type?: string }): Blob };
1243
+ interface File extends Blob {
1244
+ readonly name: string;
1245
+ readonly lastModified: number;
1246
+ }
1247
+ declare var File: { new (fileBits: BlobPart[], fileName: string, options?: { type?: string; lastModified?: number }): File };
1248
+
1249
+ type FormDataEntryValue = string | File;
1250
+ interface FormData extends Iterable<[string, FormDataEntryValue]> {
1251
+ append(name: string, value: string | Blob, fileName?: string): void;
1252
+ set(name: string, value: string | Blob, fileName?: string): void;
1253
+ get(name: string): FormDataEntryValue | null;
1254
+ getAll(name: string): FormDataEntryValue[];
1255
+ has(name: string): boolean;
1256
+ delete(name: string): void;
1257
+ entries(): [string, FormDataEntryValue][];
1258
+ keys(): string[];
1259
+ values(): FormDataEntryValue[];
1260
+ forEach(callback: (value: FormDataEntryValue, key: string, parent: FormData) => void): void;
1261
+ [Symbol.iterator](): Iterator<[string, FormDataEntryValue]>;
1262
+ }
1263
+ declare var FormData: { new (): FormData };
1264
+
1265
+ // --- fetch (WHATWG Fetch API, as in Node) ---
1266
+
1267
+ type HeadersInit = Headers | Record<string, string> | [string, string][];
1268
+ interface Headers {
1269
+ get(name: string): string | null;
1270
+ getSetCookie(): string[];
1271
+ has(name: string): boolean;
1272
+ set(name: string, value: string): void;
1273
+ append(name: string, value: string): void;
1274
+ delete(name: string): void;
1275
+ entries(): [string, string][];
1276
+ keys(): string[];
1277
+ values(): string[];
1278
+ forEach(callback: (value: string, key: string, parent: Headers) => void): void;
1279
+ [Symbol.iterator](): Iterator<[string, string]>;
1280
+ }
1281
+ declare var Headers: { new (init?: HeadersInit): Headers };
1282
+
1283
+ type BodyInit = string | Uint8Array | URLSearchParams | Blob | FormData | ReadableStream<Uint8Array | string>;
1284
+ interface Body {
1285
+ readonly body: ReadableStream<Uint8Array> | null;
1286
+ readonly bodyUsed: boolean;
1287
+ text(): Promise<string>;
1288
+ json(): Promise<any>;
1289
+ bytes(): Promise<Uint8Array>;
1290
+ arrayBuffer(): Promise<Uint8Array>;
1291
+ blob(): Promise<Blob>;
1292
+ formData(): Promise<FormData>;
1293
+ }
1294
+ interface RequestInit {
1295
+ method?: string;
1296
+ headers?: HeadersInit;
1297
+ body?: BodyInit | null;
1298
+ redirect?: 'follow' | 'manual' | 'error';
1299
+ signal?: AbortSignal | null;
1300
+ duplex?: 'half';
1301
+ }
1302
+ interface Request extends Body {
1303
+ readonly url: string;
1304
+ readonly method: string;
1305
+ readonly headers: Headers;
1306
+ readonly redirect: 'follow' | 'manual' | 'error';
1307
+ readonly signal: AbortSignal;
1308
+ clone(): Request;
1309
+ }
1310
+ declare var Request: { new (input: string | URL | Request, init?: RequestInit): Request };
1311
+
1312
+ interface ResponseInit {
1313
+ status?: number;
1314
+ statusText?: string;
1315
+ headers?: HeadersInit;
1316
+ }
1317
+ interface Response extends Body {
1318
+ readonly status: number;
1319
+ readonly statusText: string;
1320
+ readonly ok: boolean;
1321
+ readonly headers: Headers;
1322
+ readonly url: string;
1323
+ readonly redirected: boolean;
1324
+ readonly type: 'basic' | 'default' | 'error';
1325
+ clone(): Response;
1326
+ }
1327
+ declare var Response: {
1328
+ new (body?: BodyInit | null, init?: ResponseInit): Response;
1329
+ json(data: any, init?: ResponseInit): Response;
1330
+ error(): Response;
1331
+ redirect(url: string | URL, status?: number): Response;
1332
+ };
1333
+
1334
+ declare function fetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;
1335
+
1336
+ declare function setImmediate<A extends any[]>(callback: (...args: A) => void, ...args: A): NodeJS.Immediate;
1337
+ declare function clearImmediate(immediate?: NodeJS.Immediate | number): void;
1338
+
1339
+ declare namespace NodeJS {
1340
+ // Timer handles: an unref'ed timer does not keep the process alive
1341
+ interface Timeout {
1342
+ ref(): this;
1343
+ unref(): this;
1344
+ hasRef(): boolean;
1345
+ refresh(): this;
1346
+ close(): this;
1347
+ }
1348
+ interface Immediate {
1349
+ ref(): this;
1350
+ unref(): this;
1351
+ hasRef(): boolean;
1352
+ }
1353
+ // Errors thrown by Node APIs: err.code ('ENOENT', 'ERR_INVALID_URL', …)
1354
+ interface ErrnoException extends Error {
1355
+ errno?: number;
1356
+ code?: string;
1357
+ path?: string;
1358
+ syscall?: string;
1359
+ /** dns errors: the queried name */
1360
+ hostname?: string;
1361
+ /** net errors: the remote address and port */
1362
+ address?: string;
1363
+ port?: number;
1364
+ }
1365
+ }
1366
+
1367
+ // --- Test helper ---
1368
+
1369
+ declare function assert(condition: boolean, message?: string): void;
1370
+
1371
+ // --- JSX (.tsx renders to HTML strings) ---
1372
+
1373
+ declare namespace JSX {
1374
+ // A JSX expression is an HTML string; multiple children form a list that
1375
+ // concatenates to one string.
1376
+ type Element = string | readonly Element[];
1377
+ interface IntrinsicElements {
1378
+ [name: string]: any;
1379
+ }
1380
+ interface ElementChildrenAttribute {
1381
+ children: {};
1382
+ }
1383
+ }