typenative 0.7.0 → 0.7.1

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 (217) hide show
  1. package/bin/node/assert.js +2 -2
  2. package/bin/node/child_process.js +66 -8
  3. package/bin/node/fs.js +1012 -4
  4. package/bin/node/histogram.js +1991 -0
  5. package/bin/node/process.js +14 -2
  6. package/bin/node/sqlite.js +1488 -5
  7. package/bin/node/stream.js +2 -1
  8. package/bin/node/system_extra.js +3 -270
  9. package/bin/node/test.js +39 -1
  10. package/bin/node/test_report.js +47 -1
  11. package/bin/node/test_run.js +57 -2
  12. package/bin/node/util.js +8 -5
  13. package/bin/node/webassembly.js +20 -5
  14. package/bin/node/webview.js +3257 -244
  15. package/bin/node/zlib.js +118 -14
  16. package/bin/node/zlib_iter.js +585 -0
  17. package/bin/transpiler.js +1370 -258
  18. package/bin/version.js +1 -1
  19. package/govendor/software.sslmate.com/src/go-pkcs12/.gitattributes +10 -0
  20. package/govendor/software.sslmate.com/src/go-pkcs12/LICENSE +28 -0
  21. package/govendor/software.sslmate.com/src/go-pkcs12/README.md +31 -0
  22. package/govendor/software.sslmate.com/src/go-pkcs12/bmp-string.go +63 -0
  23. package/govendor/software.sslmate.com/src/go-pkcs12/crypto.go +331 -0
  24. package/govendor/software.sslmate.com/src/go-pkcs12/errors.go +23 -0
  25. package/govendor/software.sslmate.com/src/go-pkcs12/go.mod +3 -0
  26. package/govendor/software.sslmate.com/src/go-pkcs12/internal/rc2/rc2.go +271 -0
  27. package/govendor/software.sslmate.com/src/go-pkcs12/mac.go +202 -0
  28. package/govendor/software.sslmate.com/src/go-pkcs12/pbkdf.go +184 -0
  29. package/govendor/software.sslmate.com/src/go-pkcs12/pkcs12.go +1000 -0
  30. package/govendor/software.sslmate.com/src/go-pkcs12/safebags.go +107 -0
  31. package/package.json +10 -1
  32. package/types/tsconfig.json +17 -0
  33. package/types/typenative-npm.d.ts +492 -12
  34. package/types/typenative.d.ts +88 -2
  35. package/.gitattributes +0 -1
  36. package/.github/workflows/ci.yml +0 -68
  37. package/.github/workflows/npm-publish-github-packages.yml +0 -88
  38. package/CHANGELOG.md +0 -1746
  39. package/CONTRIBUTION.md +0 -133
  40. package/conformance.md +0 -1497
  41. package/examples/README.md +0 -114
  42. package/examples/angular-templates/README.md +0 -141
  43. package/examples/angular-templates/bench.mjs +0 -173
  44. package/examples/angular-templates/dom-type-globals.d.ts +0 -21
  45. package/examples/angular-templates/dom-type-stubs.ts +0 -21
  46. package/examples/angular-templates/main.ts +0 -135
  47. package/examples/angular-templates/parity.mjs +0 -157
  48. package/examples/angular-templates/run-node.mjs +0 -69
  49. package/examples/angular-templates/vendor/angular/compiler/LICENSE +0 -21
  50. package/examples/desktop-notes/README.md +0 -106
  51. package/examples/desktop-notes/bench.mjs +0 -125
  52. package/examples/desktop-notes/main.ts +0 -131
  53. package/examples/desktop-notes/package-lock.json +0 -726
  54. package/examples/desktop-notes/package.json +0 -9
  55. package/examples/desktop-notes/ui.ts +0 -176
  56. package/examples/dupe-finder/README.md +0 -78
  57. package/examples/dupe-finder/bench.mjs +0 -120
  58. package/examples/dupe-finder/main.ts +0 -87
  59. package/examples/fibonacci/README.md +0 -89
  60. package/examples/fibonacci/bench.mjs +0 -87
  61. package/examples/fibonacci/main.ts +0 -21
  62. package/examples/hello-world/README.md +0 -62
  63. package/examples/hello-world/bench.mjs +0 -66
  64. package/examples/hello-world/main.ts +0 -7
  65. package/examples/json-server/README.md +0 -132
  66. package/examples/json-server/bench.mjs +0 -263
  67. package/examples/json-server/main.ts +0 -67
  68. package/examples/mandelbrot-png/README.md +0 -63
  69. package/examples/mandelbrot-png/bench.mjs +0 -95
  70. package/examples/mandelbrot-png/main.ts +0 -98
  71. package/examples/mandelbrot-png/preview.png +0 -0
  72. package/examples/marked-cli/README.md +0 -174
  73. package/examples/marked-cli/bench.mjs +0 -178
  74. package/examples/marked-cli/main.ts +0 -410
  75. package/examples/marked-cli/parity.mjs +0 -185
  76. package/examples/marked-cli/vendor/marked/LICENSE +0 -44
  77. package/examples/marked-cli/vendor/marked/VENDOR.md +0 -26
  78. package/examples/openai-chat/README.md +0 -148
  79. package/examples/openai-chat/bench.mjs +0 -175
  80. package/examples/openai-chat/main.ts +0 -488
  81. package/examples/react-compiler/README.md +0 -185
  82. package/examples/react-compiler/bench.mjs +0 -181
  83. package/examples/react-compiler/main.ts +0 -324
  84. package/examples/react-compiler/parity.mjs +0 -362
  85. package/examples/react-compiler/run-node.mjs +0 -90
  86. package/examples/react-compiler/vendor/babel/LICENSE +0 -22
  87. package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-lower.json +0 -15
  88. package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-upper.json +0 -51
  89. package/examples/react-compiler/vendor/charcodes/package.json +0 -25
  90. package/examples/react-compiler/vendor/invariant/LICENSE +0 -21
  91. package/examples/react-compiler/vendor/invariant/invariant.cjs +0 -51
  92. package/examples/react-compiler/vendor/invariant/invariant.d.cts +0 -11
  93. package/examples/react-compiler/vendor/invariant/types/LICENSE +0 -21
  94. package/examples/react-compiler/vendor/jridgewell/gen-mapping/LICENSE +0 -19
  95. package/examples/react-compiler/vendor/jridgewell/resolve-uri/LICENSE +0 -19
  96. package/examples/react-compiler/vendor/jridgewell/sourcemap-codec/LICENSE +0 -19
  97. package/examples/react-compiler/vendor/jridgewell/trace-mapping/LICENSE +0 -19
  98. package/examples/react-compiler/vendor/js-tokens/LICENSE +0 -21
  99. package/examples/react-compiler/vendor/js-tokens/index.cjs +0 -23
  100. package/examples/react-compiler/vendor/js-tokens/index.d.cts +0 -13
  101. package/examples/react-compiler/vendor/jsesc/LICENSE-MIT.txt +0 -20
  102. package/examples/react-compiler/vendor/jsesc/jsesc.cjs +0 -337
  103. package/examples/react-compiler/vendor/jsesc/jsesc.d.cts +0 -384
  104. package/examples/react-compiler/vendor/jsesc/types/LICENSE +0 -21
  105. package/examples/react-compiler/vendor/picocolors/LICENSE +0 -15
  106. package/examples/react-compiler/vendor/picocolors/picocolors.cjs +0 -75
  107. package/examples/react-compiler/vendor/picocolors/picocolors.d.cts +0 -5
  108. package/examples/react-compiler/vendor/picocolors/types.d.ts +0 -51
  109. package/examples/react-compiler/vendor/react-compiler/LICENSE +0 -21
  110. package/examples/react-compiler/vendor/stubs/babel-core.ts +0 -31
  111. package/examples/react-compiler/vendor/stubs/debug.ts +0 -18
  112. package/examples/react-compiler/vendor/stubs/js-tokens.d.ts +0 -13
  113. package/examples/react-compiler/vendor/stubs/pretty-format.ts +0 -18
  114. package/examples/react-compiler/vendor/zod/LICENSE +0 -21
  115. package/examples/react-compiler/vendor/zod-validation-error/LICENSE +0 -9
  116. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/NonEmptyArray.ts +0 -5
  117. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinPath.ts +0 -49
  118. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinValues.ts +0 -48
  119. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/stringify.ts +0 -50
  120. package/examples/react-compiler/vendor/zod-validation-error/lib/utils/titleCase.ts +0 -6
  121. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/MessageBuilder.ts +0 -126
  122. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/ValidationError.ts +0 -39
  123. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/custom.ts +0 -12
  124. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/errorMap.ts +0 -78
  125. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/index.ts +0 -2
  126. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidElement.ts +0 -12
  127. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidKey.ts +0 -12
  128. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidStringFormat.ts +0 -131
  129. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidType.ts +0 -54
  130. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidUnion.ts +0 -12
  131. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidValue.ts +0 -40
  132. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/notMultipleOf.ts +0 -12
  133. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooBig.ts +0 -76
  134. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooSmall.ts +0 -76
  135. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/types.ts +0 -27
  136. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/unrecognizedKeys.ts +0 -27
  137. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromError.ts +0 -13
  138. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodError.ts +0 -61
  139. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodIssue.ts +0 -38
  140. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/index.ts +0 -20
  141. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationError.ts +0 -5
  142. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationErrorLike.ts +0 -8
  143. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isZodErrorLike.ts +0 -11
  144. package/examples/react-compiler/vendor/zod-validation-error/lib/v4/toValidationError.ts +0 -20
  145. package/examples/react-compiler/vendor.mjs +0 -688
  146. package/examples/todo-cli/README.md +0 -69
  147. package/examples/todo-cli/bench.mjs +0 -89
  148. package/examples/todo-cli/main.ts +0 -92
  149. package/examples/yaml-cli/README.md +0 -152
  150. package/examples/yaml-cli/bench.mjs +0 -265
  151. package/examples/yaml-cli/main.ts +0 -251
  152. package/examples/yaml-cli/parity.mjs +0 -156
  153. package/examples/yaml-cli/vendor/yaml/LICENSE +0 -13
  154. package/examples/yaml-cli/vendor/yaml/VENDOR.md +0 -25
  155. package/performance/README.md +0 -248
  156. package/performance/any-dynamic.ts +0 -21
  157. package/performance/any-record-view.ts +0 -20
  158. package/performance/arr-for-of.ts +0 -29
  159. package/performance/arr-hof.ts +0 -21
  160. package/performance/arr-push-index.ts +0 -15
  161. package/performance/arr-push-local.ts +0 -39
  162. package/performance/arr-slice-concat.ts +0 -24
  163. package/performance/arr-sort.ts +0 -21
  164. package/performance/async-await.ts +0 -24
  165. package/performance/async-promise-all.ts +0 -38
  166. package/performance/bigint-arith.ts +0 -36
  167. package/performance/buf-encode.ts +0 -29
  168. package/performance/class-accessors.ts +0 -48
  169. package/performance/class-dispatch.ts +0 -52
  170. package/performance/date-format.ts +0 -18
  171. package/performance/events-emit.ts +0 -27
  172. package/performance/exc-throw-rare.ts +0 -25
  173. package/performance/exc-try-catch.ts +0 -26
  174. package/performance/fn-closures.ts +0 -29
  175. package/performance/fn-recursion-tree.ts +0 -31
  176. package/performance/fn-rest-spread.ts +0 -43
  177. package/performance/gen-for-of.ts +0 -46
  178. package/performance/gen-next.ts +0 -32
  179. package/performance/iter-helpers.ts +0 -38
  180. package/performance/json-any.ts +0 -30
  181. package/performance/json-roundtrip.ts +0 -27
  182. package/performance/map-delete.ts +0 -24
  183. package/performance/map-iterate.ts +0 -26
  184. package/performance/map-number-keys.ts +0 -37
  185. package/performance/map-string-keys.ts +0 -22
  186. package/performance/num-arith-loop.ts +0 -14
  187. package/performance/num-bitwise.ts +0 -21
  188. package/performance/num-hash-imul.ts +0 -36
  189. package/performance/num-mod-int.ts +0 -16
  190. package/performance/num-to-string.ts +0 -16
  191. package/performance/obj-alloc.ts +0 -32
  192. package/performance/obj-keys-entries.ts +0 -44
  193. package/performance/obj-optional-chain.ts +0 -42
  194. package/performance/obj-record-dict.ts +0 -24
  195. package/performance/obj-spread-destructure.ts +0 -40
  196. package/performance/regex-exec.ts +0 -29
  197. package/performance/regex-replace-fn.ts +0 -24
  198. package/performance/regex-site.ts +0 -28
  199. package/performance/set-ops.ts +0 -20
  200. package/performance/str-char-scan.ts +0 -35
  201. package/performance/str-concat-plus.ts +0 -18
  202. package/performance/str-concat.ts +0 -24
  203. package/performance/str-methods.ts +0 -24
  204. package/performance/str-short-scan.ts +0 -26
  205. package/performance/str-split-join.ts +0 -23
  206. package/performance/str-switch-compare.ts +0 -50
  207. package/performance/str-template.ts +0 -16
  208. package/performance/str-unicode.ts +0 -25
  209. package/performance/typed-array.ts +0 -30
  210. package/performance/union-switch.ts +0 -57
  211. package/performance/union-typeof.ts +0 -40
  212. package/performance/wasm-call.ts +0 -63
  213. package/tsparser/check.go +0 -158
  214. package/tsparser/go.mod +0 -14
  215. package/tsparser/go.sum +0 -22
  216. package/tsparser/main.go +0 -363
  217. package/tsparser/tsparser.exe +0 -4
package/conformance.md DELETED
@@ -1,1497 +0,0 @@
1
- # Conformance
2
-
3
- Every TypeScript language feature and standard-library API TypeNative aims to
4
- support, split by area. Each ✅ row links to the [conformance/](conformance/)
5
- probe that proves it transpiles correctly (`npm run conformance`, filter with an
6
- optional substring: `node scripts/conformance.mjs <filter>`; `--native` runs the
7
- self-hosted binary). The same run also type-checks and builds every program in
8
- [examples/](#examples).
9
-
10
- | Status | Meaning |
11
- | :----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
12
- | ✅ | Implemented; the linked probe proves it (`—` in the Probe column: implemented, not probed yet) |
13
- | ❌ | Not implemented yet, but feasible: a known gap |
14
- | 🚫 | Will not be implemented: needs something a native Go binary doesn't have (a JavaScript engine, mutable prototypes, shared memory between isolates, cgo), or is deprecated upstream |
15
-
16
- User programs are type-checked against [types/](types/) only (`lib: []`), so an API that isn't
17
- declared there fails the type check before it reaches the transpiler.
18
- [Known limitations](#known-limitations-) lists the structural limits behind the 🚫 rows.
19
-
20
- ## Basic types
21
-
22
- | Feature | Status | Probe | Notes |
23
- | ----------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
24
- | `number` | ✅ | [syntax-arithmetic.ts](conformance/syntax-arithmetic.ts) | Transpiled to `float64` |
25
- | `boolean` | ✅ | [syntax-variables.ts](conformance/syntax-variables.ts) | Transpiled to `bool` |
26
- | `string` | ✅ | [syntax-variables.ts](conformance/syntax-variables.ts) | |
27
- | `null` | ✅ | [syntax-null-undefined.ts](conformance/syntax-null-undefined.ts) | |
28
- | `undefined` | ✅ | [syntax-null-undefined.ts](conformance/syntax-null-undefined.ts) | |
29
- | `any` / `unknown` | ✅ | [syntax-selfhost-context.ts](conformance/syntax-selfhost-context.ts) | Dynamic values handled at runtime (JSON-like objects, arrays, primitives) |
30
- | A variable declared `any` / `unknown` with a primitive initializer (`const x: any = '6'`) | ✅ | [semantics-any-variables.ts](conformance/semantics-any-variables.ts) | Dynamic: `-` `*` `/` use ToNumber, `==` coerces like JS, reassignment to another type works. `any + number` adds numbers (a string operand isn't concatenated), while `+` on two dynamic values decides at run time like JS ([syntax-callback-destructuring.ts](conformance/syntax-callback-destructuring.ts)); objects keep their inferred type |
31
- | Nullable types (`T \| null`, `T \| undefined`) | ✅ | [syntax-null-undefined.ts](conformance/syntax-null-undefined.ts) | Transpiled to Go pointer types |
32
- | `bigint` | ✅ | [syntax-bigint.ts](conformance/syntax-bigint.ts) | `2n` literals → `*big.Int`; `**` → `.Exp`, comparisons via `.Cmp` |
33
- | `bigint` bitwise / shift operators (`&`, `\|`, `^`, `~`, `<<`, `>>`, compound forms) | ✅ | [syntax-bigint-bitwise.ts](conformance/syntax-bigint-bitwise.ts) | `math/big`'s two's-complement `And` / `Or` / `Xor` / `Not`; shifts round toward -Infinity |
34
- | `BigInt()`, `BigInt.asIntN` / `asUintN` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | Integers, numeric strings and booleans; a fraction throws a `RangeError`, a bad string a `SyntaxError` |
35
- | bigint–number loose comparisons (`5n == 5`) | ✅ | [semantics-bigint-loose-ops.ts](conformance/semantics-bigint-loose-ops.ts) | `==` compares values (also with an integer string or a boolean); `===` is `false` — different types; the relational operators compare exactly (NaN is never ordered). A static `5n == 5` is a TS2367 type error, as in tsc — these go through dynamic (any) values |
36
- | `symbol` | ✅ | [syntax-symbols.ts](conformance/syntax-symbols.ts) | `Symbol()` → unique `*TnSymbol` pointers, usable as record keys |
37
- | `object` type | ✅ | [syntax-object-type.ts](conformance/syntax-object-type.ts) | `object` → `interface{}` |
38
- | `void` / `never` | ✅ | [syntax-void-never.ts](conformance/syntax-void-never.ts) | No return value in Go |
39
-
40
- ## Variables & destructuring
41
-
42
- | Feature | Status | Probe | Notes |
43
- | ---------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
44
- | Variable declarations (`let` / `const`) | ✅ | [syntax-variables.ts](conformance/syntax-variables.ts) | |
45
- | Array destructuring | ✅ | [syntax-destructuring.ts](conformance/syntax-destructuring.ts) | Parenthesized initializers; elision and element/property reads |
46
- | Object destructuring | ✅ | [syntax-destructuring.ts](conformance/syntax-destructuring.ts) | Parenthesized initializers; elision and element/property reads; the initializer is evaluated once ([lib-node-worker-threads.ts](conformance/lib-node-worker-threads.ts)) |
47
- | Destructuring with defaults | ✅ | [syntax-destructuring-defaults.ts](conformance/syntax-destructuring-defaults.ts) | Missing elements/properties take defaults (nil- and bounds-checked) |
48
- | Array destructuring with a rest element (`const [a, ...rest] = arr`) | ✅ | [syntax-destructuring-rest.ts](conformance/syntax-destructuring-rest.ts) | `rest` is a copy of the remaining elements, empty past the end |
49
- | Array destructuring past the end without a default (`const [a] = []` gives `undefined`) | ✅ | [semantics-destructure-past-end.ts](conformance/semantics-destructure-past-end.ts) | The binding is `undefined`; a default fills a missing element |
50
- | Destructured parameters | ✅ | [syntax-destructuring-params.ts](conformance/syntax-destructuring-params.ts) | `function f({ a, b }: T)`, `([x, y]: number[])` |
51
- | Destructured callback parameters (`([k, v]) => …`, `({ a }) => …`), `[...map]`, `map.entries()`, `{ ...record, k: v }` | ✅ | [syntax-callback-destructuring.ts](conformance/syntax-callback-destructuring.ts) | Without annotations, in `map` / `filter` / `some` & co. over tuples, Map pairs and `Object.entries`; elements of mixed tuples are dynamic |
52
- | Object shorthand | ✅ | [lib-go-container-heap.ts](conformance/lib-go-container-heap.ts) | `{ name, priority }` takes the fields from same-named variables |
53
- | Object spread | ✅ | [syntax-object-spread.ts](conformance/syntax-object-spread.ts) | Spread sources copied field-by-field into the new struct |
54
- | Array spread | ✅ | [syntax-array-spread.ts](conformance/syntax-array-spread.ts) | `[...arr]`, `fn(...args)` |
55
- | `delete` operator | ✅ | [syntax-delete.ts](conformance/syntax-delete.ts) | `delete o.key` on records |
56
- | Computed keys | ✅ | [syntax-computed-keys.ts](conformance/syntax-computed-keys.ts) | Computed keys become map entries; `o.name` reads lower to `.Get("name")` |
57
- | Records / dictionaries | ✅ | [syntax-in-operator.ts](conformance/syntax-in-operator.ts) | `Record<K, V>` and objects indexed by key → Go maps; so are literals with keys that aren't identifiers (`{ 'Content-Type': … }`, [lib-node-http-server.ts](conformance/lib-node-http-server.ts)) |
58
- | Reading a missing key of a `Record` / `Map` of primitives (`rec[k] === undefined`) | ✅ | [semantics-record-missing-key.ts](conformance/semantics-record-missing-key.ts) | A missing key reads `undefined`, so the comparison is the key's presence (comma-ok); `k in rec` / `map.has(k)` unchanged |
59
- | Tuples | ✅ | [syntax-tuples.ts](conformance/syntax-tuples.ts) | `[string, number]` fixed-length arrays |
60
- | Top-level / module-scope variables | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Functions see main-file top-level variables |
61
- | Names that are Go keywords, builtins or types (`string`, `len`, `range`) as variables, parameters and members | ✅ | [syntax-go-reserved-names.ts](conformance/syntax-go-reserved-names.ts) | Variables and parameters are renamed; members keep their name (keywords get a trailing `_`) |
62
- | Numeric separators | ✅ | [syntax-numeric-separators.ts](conformance/syntax-numeric-separators.ts) | `1_000_000` |
63
- | Hex / octal / binary literals | ✅ | [syntax-numeric-literals.ts](conformance/syntax-numeric-literals.ts) | `0xFF`, `0o17`, `0b1010`, `1e3` |
64
- | `var` declarations (hoisting) | ✅ | [syntax-var.ts](conformance/syntax-var.ts) | Function- and module-level `var` |
65
- | `using` / `await using` declarations | ✅ | [syntax-using.ts](conformance/syntax-using.ts) | Disposed in reverse order when the block ends (`defer`); `[Symbol.dispose]` methods |
66
- | Writing past the end of an array (`arr[arr.length + 2] = x`) | ✅ | [semantics-array-growth.ts](conformance/semantics-array-growth.ts) | The array grows; holes read as the zero value (`0`, `""`), not `undefined` |
67
- | Sparse-array holes | 🚫 | — | Slices have no holes: a hole would read as the zero value, not `undefined` |
68
- | `let x;` / `let x = undefined` typed from later assignments | ✅ | [syntax-evolving-let.ts](conformance/syntax-evolving-let.ts) | The variable takes the type of the values assigned to it (in a `try`, a loop, a later statement) |
69
- | `$` in identifiers (`$EOF`, `obs$`, `$implicit`) | ✅ | [syntax-dollar-identifiers.ts](conformance/syntax-dollar-identifiers.ts) | Go names use `ǂ` for `$`; JSON keys keep `$` |
70
- | `let x;` assigned on every path before it is read | ✅ | [syntax-let-and-narrowing.ts](conformance/syntax-let-and-narrowing.ts) | Holds its value type, not `any`; `.at()` past either end is `undefined`; unary `+` on a string is `Number()` |
71
-
72
- ## Operators
73
-
74
- | Feature | Status | Probe | Notes |
75
- | ----------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
76
- | Arithmetic operators | ✅ | [syntax-arithmetic.ts](conformance/syntax-arithmetic.ts) | `+`, `-`, etc.; `%`/`%=` via `math.Mod` |
77
- | Exponent operator | ✅ | [syntax-exponent.ts](conformance/syntax-exponent.ts) | `2 ** 10` |
78
- | Bitwise operators | ✅ | [syntax-bitwise.ts](conformance/syntax-bitwise.ts) | `&`, `\|`, `^`, `<<`, `>>` |
79
- | Unsigned shift | ✅ | [syntax-unsigned-shift.ts](conformance/syntax-unsigned-shift.ts) | `>>>` |
80
- | Comparison operators | ✅ | [syntax-variables.ts](conformance/syntax-variables.ts) | `==`, `!=`, `===`, `!==`, etc. |
81
- | Logical operators | ✅ | [syntax-variables.ts](conformance/syntax-variables.ts) | `&&`, `\|\|` |
82
- | Increment / decrement | ✅ | [syntax-increment-expression.ts](conformance/syntax-increment-expression.ts) | `++`, `--`, incl. as expressions |
83
- | Non-null assertion (`!`) | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Stripped during transpilation |
84
- | Ternary expressions | ✅ | [syntax-ternary.ts](conformance/syntax-ternary.ts) | `condition ? a : b` |
85
- | Nullish coalescing | ✅ | [syntax-nullish.ts](conformance/syntax-nullish.ts) | `??` operator, incl. chains |
86
- | Optional chaining | ✅ | [syntax-optional-chaining.ts](conformance/syntax-optional-chaining.ts) | `obj?.prop`, `arr?.[i]`, chains across calls |
87
- | Nullish / logical assignment | ✅ | [syntax-logical-assignment.ts](conformance/syntax-logical-assignment.ts) | `??=`, `\|\|=`, `&&=` |
88
- | `in` operator | ✅ | [syntax-in-operator.ts](conformance/syntax-in-operator.ts) | `"key" in obj` on records |
89
- | `typeof` | ✅ | [syntax-typeof.ts](conformance/syntax-typeof.ts) | `typeof x === "string"`; `"function"` for function values |
90
- | `instanceof` | ✅ | [syntax-instanceof.ts](conformance/syntax-instanceof.ts) | User classes, `Error` classes and Node globals (`URL`, `Uint8Array`, …) |
91
- | JS truthiness | ✅ | [syntax-optional-params.ts](conformance/syntax-optional-params.ts) | `if (str)`, `!count`, `a \|\| fallback` on any type |
92
- | Loose equality (`==`) | ✅ | [semantics-loose-equality.ts](conformance/semantics-loose-equality.ts), [semantics-any-variables.ts](conformance/semantics-any-variables.ts) | `bool`/`number`/`string` mixtures coerce like JS (`TnNumber`/`TnParseFloat`), also between `any` values (`TnLooseEqual`) |
93
- | Optional call (`fn?.()`) | ✅ | [syntax-optional-call.ts](conformance/syntax-optional-call.ts) | Nil check on the function value; result is nullable |
94
- | Comma operator | ✅ | [syntax-comma-operator.ts](conformance/syntax-comma-operator.ts) | In `for` headers (`i = 0, j = 10` / `i++, j--`) |
95
- | `void` operator | ✅ | [syntax-void-operator.ts](conformance/syntax-void-operator.ts) | Evaluates, then `nil` |
96
- | `new.target` | ✅ | [syntax-new-target.ts](conformance/syntax-new-target.ts) | Constructors pass the target class name through `super()` chains |
97
- | `instanceof Map` / `Set` / `Date` / `Array`, subclass instances | ✅ | [syntax-instanceof-builtins.ts](conformance/syntax-instanceof-builtins.ts) | Maps and Sets made by `new Map()` / `new Set()` are tagged (records are not Maps); arrays exclude Buffers; `instanceof Parent` holds for subclass instances |
98
- | `#x in obj` (private brand checks) | ✅ | [syntax-instanceof-builtins.ts](conformance/syntax-instanceof-builtins.ts) | An instance of the class declaring `#x`, or of a subclass |
99
- | Optional calls on `any` values (`o?.m()`, `a?.b.c?.get(k)`) | ✅ | [syntax-optional-call-any.ts](conformance/syntax-optional-call-any.ts) | Nothing is called when the receiver is nullish; the result can initialize a typed variable |
100
- | `x?.m()` on an `any` value when `m` has a known primitive result (`s?.toUpperCase()`) | ✅ | [semantics-optional-any-call.ts](conformance/semantics-optional-any-call.ts) | A nullish `x` gives `undefined` (so `?? fallback` applies and `=== undefined` holds); a set receiver calls through |
101
- | Assignment as an expression (`while ((m = re.exec(s)))`, `a = b = c`, `x = (o[k] ??= v)`) | ✅ | [syntax-assignment-expressions.ts](conformance/syntax-assignment-expressions.ts) | Assigns, then reads the target back; `??=` on a map element tests for a missing key |
102
-
103
- ## Control flow
104
-
105
- | Feature | Status | Probe | Notes |
106
- | -------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
107
- | If / else statements | ✅ | [syntax-if-switch.ts](conformance/syntax-if-switch.ts) | Incl. unbraced bodies and else-if chains |
108
- | Switch statements | ✅ | [syntax-switch.ts](conformance/syntax-switch.ts) | Case and default statements |
109
- | Switch fallthrough | ✅ | [syntax-switch-fallthrough.ts](conformance/syntax-switch-fallthrough.ts) | Explicit fallthrough between cases |
110
- | `for` loops | ✅ | [syntax-loops.ts](conformance/syntax-loops.ts) | Standard `for` loops, incl. unbraced bodies |
111
- | `continue` | ✅ | [syntax-loops.ts](conformance/syntax-loops.ts) | `continue` in all loop kinds |
112
- | `break` | ✅ | [syntax-if-switch.ts](conformance/syntax-if-switch.ts), [syntax-do-while.ts](conformance/syntax-do-while.ts) | In switch cases and loops |
113
- | `for...of` loops | ✅ | [syntax-loops.ts](conformance/syntax-loops.ts), [syntax-for-of-string.ts](conformance/syntax-for-of-string.ts) | Arrays, Maps, Sets, strings, tuples; `Object.entries()` unwrapping |
114
- | `for...in` loops | ✅ | [syntax-for-in.ts](conformance/syntax-for-in.ts) | Key range over records/maps |
115
- | `for await...of` | ✅ | [syntax-for-await.ts](conformance/syntax-for-await.ts) | Ranges over the async generator's channel |
116
- | `while` loops | ✅ | [syntax-loops.ts](conformance/syntax-loops.ts) | Transpiled to Go's `for` loops; assignment in condition |
117
- | `do...while` loops | ✅ | [syntax-do-while.ts](conformance/syntax-do-while.ts) | Implemented with conditional break |
118
- | Labeled loops | ✅ | [syntax-labeled-loops.ts](conformance/syntax-labeled-loops.ts) | `LabeledStatement` → Go labels; labeled `continue`/`break` |
119
- | `try` / `catch` / `finally` | ✅ | [syntax-try-catch-finally.ts](conformance/syntax-try-catch-finally.ts) | `throw` → `panic`; catch/finally via `defer`/`recover` |
120
- | Optional catch binding (`catch {}`) | ✅ | [syntax-try-catch-finally.ts](conformance/syntax-try-catch-finally.ts) | |
121
- | Custom error classes | ✅ | [syntax-custom-errors.ts](conformance/syntax-custom-errors.ts) | `extends Error` → embedded `TnError`; constructors take the message |
122
- | `Error.message` | ✅ | [syntax-error-message.ts](conformance/syntax-error-message.ts) | `throw new Error` panics with a `*TnError`; `.message` on caught values |
123
- | `Error` `cause` (`new Error(message, { cause })`, `err.cause`) | ✅ | [lib-node-fetch-bad-port.ts](conformance/lib-node-fetch-bad-port.ts) | Built-in error classes too |
124
- | Narrowing | ✅ | [syntax-typeof.ts](conformance/syntax-typeof.ts) | `T \| undefined` narrowed after `if (x)`, `x !== undefined`, early returns |
125
- | Exhaustive `switch` without `default`; statements after a `switch` | ✅ | [syntax-switch-exhaustive.ts](conformance/syntax-switch-exhaustive.ts) | A function that can end without a `return` returns its result type's zero value (JS: `undefined`) |
126
- | Labeled blocks and statements (`label: { … break label; }`) | ✅ | [syntax-labeled-blocks.ts](conformance/syntax-labeled-blocks.ts) | `break label` jumps past the statement (`goto`) |
127
- | Throwing non-`Error` values (`throw 'x'`, `throw { code: 1 }`) | ✅ | [semantics-throw-non-error.ts](conformance/semantics-throw-non-error.ts) | Caught as `interface{}`; properties read dynamically |
128
- | `debugger` | ✅ | [syntax-debugger.ts](conformance/syntax-debugger.ts) | Erased |
129
- | `with` | 🚫 | — | Not allowed in strict mode (modules are strict) |
130
- | Assignments and compound assignments as values, comma expressions, `for (let x; …)` headers, several updates per iteration | ✅ | [syntax-loop-lowerings.ts](conformance/syntax-loop-lowerings.ts) | `(ch = s[i += 1])` in a condition, `a = b = 7`, `(k++, k * 10)`; Go-only statements are lowered to closures |
131
- | `continue` in `do…while`; `default` falling through to later cases; labeled `break` out of a `switch` | ✅ | [syntax-loop-lowerings.ts](conformance/syntax-loop-lowerings.ts) | `continue` re-tests the condition |
132
- | `for…of` whose body never reads its variable (`for (const x of xs) n++`) | ✅ | [lib-string-split-trim.ts](conformance/lib-string-split-trim.ts) | |
133
-
134
- ## Functions
135
-
136
- | Feature | Status | Probe | Notes |
137
- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
138
- | Function declarations | ✅ | [syntax-functions.ts](conformance/syntax-functions.ts) | Transpiled to Go functions |
139
- | Arrow functions | ✅ | [syntax-arrow-functions.ts](conformance/syntax-arrow-functions.ts) | Transpiled to anonymous functions |
140
- | IIFEs | ✅ | [syntax-iife.ts](conformance/syntax-iife.ts) | `(() => { ... })()` and `(function name() { ... })()` |
141
- | Closures over mutable state | ✅ | [syntax-closures.ts](conformance/syntax-closures.ts) | Functions capturing and mutating outer variables; per-iteration `let` |
142
- | Function types | ✅ | [syntax-closures.ts](conformance/syntax-closures.ts) | `() => number`, `(x: number) => string` as type annotations |
143
- | Default parameter values | ✅ | [syntax-default-params.ts](conformance/syntax-default-params.ts) | `function(x = defaultValue)`, incl. constructors, methods, arrows |
144
- | Rest parameters | ✅ | [syntax-rest-params.ts](conformance/syntax-rest-params.ts) | `function(...args: T[])` → Go variadic |
145
- | Spread in calls | ✅ | [syntax-spread-call.ts](conformance/syntax-spread-call.ts) | `f(...args)` incl. tuples |
146
- | Optional parameters | ✅ | [syntax-optional-params.ts](conformance/syntax-optional-params.ts) | `function f(x?: string)` |
147
- | Destructured parameters | ✅ | [syntax-destructuring-params.ts](conformance/syntax-destructuring-params.ts) | `function f({ a, b }: T)`, `([x, y]: number[])` |
148
- | Contextual object-literal arguments | ✅ | [syntax-contextual-arguments.ts](conformance/syntax-contextual-arguments.ts) | Struct type inferred from parameter / return type |
149
- | Recursion | ✅ | [syntax-recursion.ts](conformance/syntax-recursion.ts) | Direct self-recursion |
150
- | Recursive arrow functions | ✅ | [syntax-recursive-arrow.ts](conformance/syntax-recursive-arrow.ts) | `const f = () => … f() …` → declared, then assigned |
151
- | Generators (`function*` / `yield` / `yield*`) | ✅ | [syntax-generators.ts](conformance/syntax-generators.ts) | `function*` runs in a goroutine sending yields over a channel; `for...of` ranges it |
152
- | Async generators (`async function*`) | ✅ | [syntax-async-generators.ts](conformance/syntax-async-generators.ts) | Goroutine + channel, consumed with `for await` |
153
- | Custom iterators (`Symbol.iterator`) | ✅ | [syntax-custom-iterators.ts](conformance/syntax-custom-iterators.ts) | `*[Symbol.iterator]()` → a `Symbol_iterator()` channel method |
154
- | `as const` assertions | ✅ | [syntax-as-const.ts](conformance/syntax-as-const.ts) | Erased during transpilation |
155
- | Function overloads | ✅ | [syntax-function-overloads.ts](conformance/syntax-function-overloads.ts) | Signatures are erased; the implementation is emitted |
156
- | `this` parameter (`function f(this: T)`) | ✅ | [syntax-this-parameter.ts](conformance/syntax-this-parameter.ts) | Erased |
157
- | `arguments` object | ✅ | [syntax-arguments.ts](conformance/syntax-arguments.ts) | Functions reading it take extra arguments variadically (`[]interface{}`) |
158
- | Top-level `await` | ✅ | [syntax-top-level-await.ts](conformance/syntax-top-level-await.ts) | In modules (files with an `import` / `export`) |
159
- | Generator `next()` | ✅ | [lib-iterator-helpers.ts](conformance/lib-iterator-helpers.ts) | `{ value, done }` |
160
- | Generator `next(value)` (sending a value in) / `return()` / `throw()` | ❌ | — | Generators are goroutines feeding a channel: values only flow out (capturing a yield's value, or `next(value)` / `return()` / `throw()`, isn't supported yet) |
161
- | `fn.call` / `fn.apply` / `fn.bind` | ✅ | [syntax-function-values.ts](conformance/syntax-function-values.ts) | Function declarations and function values; `apply` spreads the array over the parameters; `thisArg` is ignored (methods taken from an object are already bound in Go) |
162
- | `fn.name` / `fn.length` | ✅ | [syntax-function-values.ts](conformance/syntax-function-values.ts) | Known at compile time for declared functions, classes and function variables |
163
- | `eval` / `new Function(…)` | 🚫 | — | Compile and run JavaScript at runtime: needs a JavaScript engine |
164
- | Properties on functions (`fn.prop = v`), call-signature types with properties | ✅ | [syntax-function-properties.ts](conformance/syntax-function-properties.ts) | Each property is a package variable `fn__prop`; reassigning it works |
165
- | `arguments` with optional parameters left out | ✅ | [syntax-arguments-object.ts](conformance/syntax-arguments-object.ts) | Omitted trailing optionals are not counted; `arguments[i]` is the value (not a pointer) |
166
- | An optional array parameter passed on to a defaulted parameter (a call or `super(…)`) | ✅ | [syntax-optional-array-params.ts](conformance/syntax-optional-array-params.ts) | Left out, the callee gets its default; `xs ?? []` on an absent array gives the fallback |
167
- | Function declarations inside functions and blocks | ✅ | [syntax-nested-functions.ts](conformance/syntax-nested-functions.ts) | Hoisted (callable before the declaration, mutually recursive), `async` and generator ones included |
168
- | Function values: a static method in a variable, static and instance methods of one name, a variadic function expression where fixed parameters are expected, a `.catch` handler, an async IIFE, method identity | ✅ | [syntax-function-values-more.ts](conformance/syntax-function-values-more.ts) | `a.m === A.prototype.m` compares the methods |
169
- | `f.apply(thisArg, args)` / `f.call` on a function held as `any` or under another name (`const f: any = fn`) | ✅ | [syntax-nullable-primitive-fields.ts](conformance/syntax-nullable-primitive-fields.ts) | `thisArg` is dropped |
170
- | Functions with array parameters stored where a function type is expected (`Record<string, (xs: any[]) => R>`): declared functions, arrows, function expressions | ✅ | [syntax-function-values-more.ts](conformance/syntax-function-values-more.ts) | A function type's arrays are plain slices: a declared function is adapted |
171
- | An array passed through a function-typed value (a callback slot) is shared with the callee | ❌ | — | The callee gets a copy: its `push` doesn't reach the caller's array (a direct call shares it; assigning the function to a slot compiles — an adapter passes the array's address — but the copy remains) |
172
- | A string method on an `any` value whose name an object literal's function also has (`spec.startsWith('.')`) | ✅ | [syntax-function-values-more.ts](conformance/syntax-function-values-more.ts) | A string runs the string method, any other value its own function |
173
-
174
- ## Classes & interfaces
175
-
176
- | Feature | Status | Probe | Notes |
177
- | ---------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
178
- | Classes | ✅ | [syntax-class.ts](conformance/syntax-class.ts) | Transpiled to Go structs with constructor and receiver methods |
179
- | Constructor parameter properties | ✅ | [syntax-class-parameter-properties.ts](conformance/syntax-class-parameter-properties.ts) | `constructor(private x: number)` |
180
- | Class inheritance | ✅ | [syntax-class-inheritance.ts](conformance/syntax-class-inheritance.ts) | `super.method()` → `self.Parent.method()`; inherited methods copied for `this` dispatch |
181
- | `implements` clauses | ✅ | [syntax-class-implements.ts](conformance/syntax-class-implements.ts) | `class C implements I` |
182
- | Interface `extends` | ✅ | [syntax-interface-extends.ts](conformance/syntax-interface-extends.ts) | Inherited properties flattened into the derived struct |
183
- | Static members | ✅ | [syntax-class-static.ts](conformance/syntax-class-static.ts) | Static members → package-level `Class_member` vars/functions |
184
- | Getters / setters (classes) | ✅ | [syntax-class-getters.ts](conformance/syntax-class-getters.ts) | `c.v` reads/writes rewrite to `Get_v()`/`Set_v()` accessor calls |
185
- | Getters (object literals) | ✅ | [syntax-object-getters.ts](conformance/syntax-object-getters.ts) | Getter closures stored as function fields; reads invoke them |
186
- | Object-literal methods | ✅ | [syntax-object-methods.ts](conformance/syntax-object-methods.ts) | Method closures stored as function fields capturing the instance (`this` → the object) |
187
- | Private `#` fields | ✅ | [syntax-class-private-fields.ts](conformance/syntax-class-private-fields.ts) | `#secret` → a `__secret` struct field, left out of `JSON.stringify` and `console.log` |
188
- | Access modifiers (`private` / `protected` / `public` on members) | ✅ | [syntax-access-modifiers.ts](conformance/syntax-access-modifiers.ts) | `private` / `protected` / `public` are erased |
189
- | Abstract classes | ✅ | [syntax-class-abstract.ts](conformance/syntax-class-abstract.ts) | Abstract members skipped; concrete methods copied onto subclasses |
190
- | Static initialization blocks (`static {}`) | ✅ | [syntax-static-blocks.ts](conformance/syntax-static-blocks.ts) | Go `func init()` |
191
- | Class expressions (`const C = class {}`) | ✅ | [syntax-class-expressions.ts](conformance/syntax-class-expressions.ts) | `const C = class {…}` becomes a class named after the variable |
192
- | Interfaces | ✅ | [syntax-class-implements.ts](conformance/syntax-class-implements.ts) | Transpiled to Go interfaces |
193
- | Optional properties | ✅ | [syntax-optional-chaining.ts](conformance/syntax-optional-chaining.ts) | `prop?: Type` in interfaces/types |
194
- | Type-aware method dispatch | ✅ | [semantics-method-dispatch.ts](conformance/semantics-method-dispatch.ts) | Class `.push()` / `.length` not confused with array builtins |
195
- | Index signatures (`[key: string]: T`) | ✅ | [syntax-index-signatures.ts](conformance/syntax-index-signatures.ts) | `{ [k: K]: V }` is `Record<K, V>` (an ordered Go map) |
196
- | Methods without a return-type annotation | ✅ | [syntax-method-return-inference.ts](conformance/syntax-method-return-inference.ts) | Inferred from the returns, as for functions (also returns nested in `if` / loops / `switch` / `try`); an inherited `return this` returns the subclass |
197
- | Field initializers reading parameter properties or parent fields | ✅ | [syntax-class-field-order.ts](conformance/syntax-class-field-order.ts) | `super()`, then parameter properties, then field initializers, then the constructor body (TS's ES2020 order) |
198
- | Arrow-function fields (`h = () => this.x`), fields reading earlier fields | ✅ | [syntax-class-arrow-fields.ts](conformance/syntax-class-arrow-fields.ts) | Run in the constructor; `this` is the instance (a field inherited by a subclass keeps the base instance, so it does not see writes the subclass makes afterwards) |
199
- | Private methods (`#m()`) | ✅ | [syntax-method-return-inference.ts](conformance/syntax-method-return-inference.ts) | |
200
- | A private and a public member with the same name (`#x` and `x`) | ✅ | [syntax-private-public-names.ts](conformance/syntax-private-public-names.ts) | `#x` is the Go field `__x` |
201
- | Private accessors (`get #x()`) / static private fields (`static #x`) | ✅ | [syntax-class-accessor-inheritance.ts](conformance/syntax-class-accessor-inheritance.ts), [syntax-class-static-inheritance.ts](conformance/syntax-class-static-inheritance.ts) | |
202
- | `accessor` fields | ✅ | [syntax-class-accessor-fields.ts](conformance/syntax-class-accessor-fields.ts) | Plain fields (decorating them is not supported) |
203
- | Static inheritance (`Child.staticOfParent()`) | ✅ | [syntax-class-static-inheritance.ts](conformance/syntax-class-static-inheritance.ts) | Resolved to the declaring class's `Parent_member` at compile time |
204
- | Inherited getters / setters, `super.x` on accessors | ✅ | [syntax-class-accessor-inheritance.ts](conformance/syntax-class-accessor-inheritance.ts) | Accessors are copied onto subclasses like methods |
205
- | Object-literal setters (`set x(v) {}`) | ✅ | [syntax-object-setters.ts](conformance/syntax-object-setters.ts) | A `Set_x` closure field: `o.x = v` calls it |
206
- | Mixin class factories (`(superClass: typeof Base) => class extends superClass {…}`, arrow / function expression / function declaration) and a function returning a subclass of a known class | ✅ | [syntax-mixins.ts](conformance/syntax-mixins.ts) | The class becomes a top-level class; the factory makes its class over the argument (`TnMixinClass`). Not supported: a generic constraint (`<T extends new (…) => any>`) and `class extends f()` — only `typeof Base` establishes the base |
207
- | Polymorphic `this` return types (fluent chains) | ✅ | [syntax-polymorphic-this.ts](conformance/syntax-polymorphic-this.ts) | `this` is the class; methods inherited by a subclass return the subclass |
208
- | Dynamic keys on class instances and typed objects (`inst[key]`) | ✅ | [syntax-instance-keys.ts](conformance/syntax-instance-keys.ts) | A `switch` over the declared fields and getters (reads and writes); through `any`, reflection |
209
- | Declaration merging (interface + interface, enum + enum, class + interface) | ✅ | [syntax-declaration-merging.ts](conformance/syntax-declaration-merging.ts) | Merged within one scope; an interface adds its properties to a same-named class as fields; namespace + function merging works too |
210
- | Prototype mutation (`C.prototype.m = …`, `Object.setPrototypeOf`, `util.inherits`) | 🚫 | — | Classes are static Go structs with fixed method sets |
211
- | Overrides dispatched on the runtime class (through a base-class type, `any` values, a base method calling an override) | ✅ | [syntax-class-polymorphism.ts](conformance/syntax-class-polymorphism.ts) | Polymorphic classes are held as `interface{}`; calls go through a per-method dispatch |
212
- | `class C extends Array` | ✅ | [syntax-array-subclass.ts](conformance/syntax-array-subclass.ts) | The elements live in an embedded `TnArray`: indexing, `length`, `push`, iteration, spread, `Array.isArray` |
213
- | Classes as values (chosen at run time, passed as `new (…) => T`, stored in records), `x.constructor` | ✅ | [syntax-class-values.ts](conformance/syntax-class-values.ts) | `new ctor(…)` works on class values and constructor functions alike |
214
- | Interfaces mixing data fields and methods, implemented by object literals | ✅ | [syntax-interface-method-fields.ts](conformance/syntax-interface-method-fields.ts) | Method shorthand and arrow properties are contextually typed; optional function fields may be absent |
215
- | `class E extends Error` setting `this.name` | ✅ | [lib-error-subclass-inspect.ts](conformance/lib-error-subclass-inspect.ts) | The subclass gets a `name` field; `util.inspect` prints `E: message` then its own properties |
216
- | `Object.setPrototypeOf(this, new.target.prototype)` in an `Error` subclass | ✅ | [syntax-error-subclass-idiom.ts](conformance/syntax-error-subclass-idiom.ts) | The ES5-era idiom is dropped (classes are already their own type); other `setPrototypeOf` calls are errors |
217
-
218
- ## Generics
219
-
220
- | Feature | Status | Probe | Notes |
221
- | ------------------------------------------------------------------------------------------ | :----: | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
222
- | Generic functions | ✅ | [syntax-generic-functions.ts](conformance/syntax-generic-functions.ts) | Type parameters → Go generics; call sites infer from arguments |
223
- | Generic classes | ✅ | [syntax-generic-classes.ts](conformance/syntax-generic-classes.ts) | Type parameters via Go generics |
224
- | Generic constraints (`<T extends U>`) | ✅ | [syntax-generic-constraints.ts](conformance/syntax-generic-constraints.ts) | Object-type bounds become `any`; properties of `T` values read dynamically |
225
- | Default type parameters (`<T = D>`) | ✅ | [syntax-generic-defaults.ts](conformance/syntax-generic-defaults.ts) | Defaults are erased; Go infers from arguments |
226
- | Generic interfaces / type aliases | ✅ | [syntax-generic-interfaces.ts](conformance/syntax-generic-interfaces.ts) | Go generic structs; literals instantiate them (`Box[float64]{…}`) |
227
- | `const` type parameters / variance annotations (`in` / `out`) | ✅ | [syntax-const-type-parameters.ts](conformance/syntax-const-type-parameters.ts) | Erased; object literals of method interfaces use an adapter struct |
228
- | Instantiation expressions (`const f = g<number>`), explicit type arguments in call results | ✅ | [syntax-instantiation-expressions.ts](conformance/syntax-instantiation-expressions.ts) | `g<number>` is the Go instantiation `g[float64]` |
229
- | Generic type aliases (`type WithId<T> = T & { id: number }`) | ✅ | [syntax-intersection-generic.ts](conformance/syntax-intersection-generic.ts) | The alias is instantiated with its type arguments |
230
-
231
- ## Enums
232
-
233
- | Feature | Status | Probe | Notes |
234
- | ---------------------------------------------- | :----: | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
235
- | Numeric enums | ✅ | [syntax-enum-numeric.ts](conformance/syntax-enum-numeric.ts) | Numeric members are `float64` constants; string enums keep a named type |
236
- | String enums | ✅ | [syntax-enum-string.ts](conformance/syntax-enum-string.ts) | `enum` declarations and member access |
237
- | `const enum` | ✅ | [syntax-const-enum.ts](conformance/syntax-const-enum.ts) | Compiled like a regular enum |
238
- | Computed / heterogeneous enum members | ✅ | [syntax-enum-computed.ts](conformance/syntax-enum-computed.ts) | Computed members assigned in source order; mixed enums keep each member's type |
239
- | Reverse mapping (`Color[0]`), `Enum['Member']` | ✅ | [syntax-enum-reverse.ts](conformance/syntax-enum-reverse.ts) | A generated `Color__name` function: the last member with the value wins; an unknown value gives `""` (JS: `undefined`). String enum members concatenate and print as strings |
240
-
241
- ## Type-system features
242
-
243
- | Feature | Status | Probe | Notes |
244
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
245
- | Type aliases | ✅ | [syntax-type-aliases.ts](conformance/syntax-type-aliases.ts) | `type P = { x: number }` → Go struct; alias-of-alias |
246
- | Union types | ✅ | [syntax-union-types.ts](conformance/syntax-union-types.ts) | Narrowed via `typeof` checks |
247
- | Type guards (`is`) | ✅ | [syntax-type-guards.ts](conformance/syntax-type-guards.ts) | `p is T` → Go `bool`; `in` checks struct fields at runtime |
248
- | `as` assertions | ✅ | [syntax-type-aliases.ts](conformance/syntax-type-aliases.ts) | `x as T`, incl. angle-bracket syntax (`<T>x`); `any` values convert to `T` |
249
- | Self-host contextual typing | ✅ | [syntax-selfhost-context.ts](conformance/syntax-selfhost-context.ts) | Object/array literals typed from context, `Record` literals, `in`, `any` params |
250
- | Decorators (`@`) | ✅ | [syntax-decorators.ts](conformance/syntax-decorators.ts) | Standard method & class decorators, applied in source order; `this` is the receiver |
251
- | Field / accessor / parameter decorators, `context.addInitializer`, `Symbol.metadata` | ❌ | — | Only method and class decorators: field and accessor decorators fail the type check (`ClassFieldDecoratorContext` / `ClassAccessorDecoratorContext` are not declared) |
252
- | Namespaces / `module` blocks | ✅ | [syntax-namespaces.ts](conformance/syntax-namespaces.ts) | Flattened to prefixed declarations (`N.f` → `N_f`), nested and in types |
253
- | `override` modifier | ✅ | [syntax-override.ts](conformance/syntax-override.ts) | Erased |
254
- | `readonly` modifier (properties, `readonly T[]`) | ✅ | [syntax-readonly.ts](conformance/syntax-readonly.ts) | Erased (`readonly T[]` → `[]T`) |
255
- | `satisfies` operator | ✅ | [syntax-satisfies.ts](conformance/syntax-satisfies.ts) | Checked by tsc, erased; the type guides literals |
256
- | `keyof` / mapped types | ✅ | [syntax-keyof-mapped-types.ts](conformance/syntax-keyof-mapped-types.ts) | `keyof` → `string`; mapped types → structs (literal keys) or maps |
257
- | Conditional types | ✅ | [syntax-conditional-types.ts](conformance/syntax-conditional-types.ts) | Resolved to their branch's Go type |
258
- | `infer` types | ✅ | [syntax-infer-types.ts](conformance/syntax-infer-types.ts) | Resolved to their branch's Go type |
259
- | `import type` / `export type` | ✅ | [syntax-import-type.ts](conformance/syntax-import-type.ts) | Type-only imports are erased |
260
- | Intersection types (`A & B`) | ✅ | [syntax-intersection-types.ts](conformance/syntax-intersection-types.ts) | Object types merge into one struct |
261
- | Literal types (`'a' \| 'b'`) | ✅ | [syntax-literal-types.ts](conformance/syntax-literal-types.ts) | Erased; string/number/boolean literals map to their base Go types |
262
- | Tuple optional / rest / labeled elements | ✅ | [syntax-tuple-elements.ts](conformance/syntax-tuple-elements.ts) | Tuples are slices |
263
- | Indexed access types (`T['k']`) | ✅ | [syntax-indexed-access-types.ts](conformance/syntax-indexed-access-types.ts) | `T['k']` resolves to the member type |
264
- | Type-level `typeof` (`typeof obj`) | ✅ | [syntax-type-typeof.ts](conformance/syntax-type-typeof.ts) | The variable's Go type |
265
- | Template literal types | ✅ | [syntax-template-literal-types.ts](conformance/syntax-template-literal-types.ts) | Template literal types → `string` |
266
- | Utility types (`Partial`, `Pick`, `Omit`, …) | ✅ | [syntax-utility-types.ts](conformance/syntax-utility-types.ts) | `Partial` / `Required` / `Readonly` / `Pick` / `Omit` / `NonNullable` → the base type |
267
- | Assertion functions (`asserts x is T`) | ✅ | [syntax-assertion-functions.ts](conformance/syntax-assertion-functions.ts) | No return value |
268
- | Callable / construct signatures (`type F = { (): void }`) | ✅ | [syntax-callable-signatures.ts](conformance/syntax-callable-signatures.ts) | Function types; a class passed as a value is its constructor |
269
- | JSX / `.tsx` syntax | ✅ | [syntax-jsx.tsx](conformance/syntax-jsx.tsx) | Renders to HTML strings (text escaped); components are calls with props |
270
- | Ambient declarations (`declare`, `.d.ts`, `x!: T`) | ✅ | [syntax-ambient-declarations.ts](conformance/syntax-ambient-declarations.ts) | `declare` only types code; `declare const` is an unset variable |
271
- | `export =` / `import x = require()` | ✅ | [syntax-export-equals.ts](conformance/syntax-export-equals.ts) | `import x = require()` is a namespace import |
272
- | Recursive types (`type Tree = { children: Tree[] }`) | ✅ | [syntax-recursive-types.ts](conformance/syntax-recursive-types.ts) | Self-referencing structs |
273
- | `typeof` / `instanceof` narrowing of `unknown` values (`string`, `number`, `boolean`, `Date`, arrays, functions, objects) | ✅ | [syntax-typeof-narrowing.ts](conformance/syntax-typeof-narrowing.ts) | Inside the branch the value has the narrowed Go type and its methods |
274
- | Forced casts (`x as unknown as T[]`) where the value is not a `T[]` | ✅ | [syntax-forced-cast.ts](conformance/syntax-forced-cast.ts) | The value stays what it is; a method returning one returns any value |
275
- | `typeof f` of a declared function as a type | ✅ | [syntax-typeof-function-type.ts](conformance/syntax-typeof-function-type.ts) | Its Go func type: values of it (record fields, destructured parameters) are called directly |
276
- | User-defined type guards (`(t): t is string`, declared or a local arrow) narrowing an optional argument | ✅ | [syntax-type-guard-narrowing.ts](conformance/syntax-type-guard-narrowing.ts) | Where the call is true, the argument is its non-nullable type |
277
- | Generic interfaces used without type arguments; interfaces extending `Omit<>` / `Pick<>` / `Partial<>`; open object types (`{ [k: string]: any; … }`); call signatures declared in a function; array types with properties (`T[] & { links: L }`) | ✅ | [syntax-object-type-forms.ts](conformance/syntax-object-type-forms.ts) | Unused type parameters are erased; an array type with properties is an `Array` subclass |
278
- | A `string \| null` (number, boolean) field holding the value, `null` or `undefined` | ✅ | [syntax-nullable-primitive-fields.ts](conformance/syntax-nullable-primitive-fields.ts) | An any field: `x \|\| null`, `x ?? null` and a conditional's `null` branch store `null`, which `JSON.stringify` writes; an absent value is left out |
279
-
280
- ## Modules & imports
281
-
282
- | Feature | Status | Probe | Notes |
283
- | ---------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
284
- | Named imports | ✅ | [syntax-import-go.ts](conformance/syntax-import-go.ts) | `import { x } from './file'` |
285
- | Import renaming (`import { x as y }`) | ✅ | [syntax-import-renaming.ts](conformance/syntax-import-renaming.ts) | Local file imports |
286
- | Named exports (`export const` / `export function`) | ✅ | [syntax-import-local.ts](conformance/syntax-import-local.ts) | Helper [import-local-helper.ts](conformance/import-local-helper.ts) exports `multiply` |
287
- | Default imports | ✅ | [syntax-import-go.ts](conformance/syntax-import-go.ts) | `import x from 'pkg'` — namespace stripped in output |
288
- | Namespace imports | ✅ | [syntax-import-go.ts](conformance/syntax-import-go.ts) | `import * as x from 'pkg'` |
289
- | Local file imports | ✅ | [syntax-import-local.ts](conformance/syntax-import-local.ts) | Relative paths transpiled to a separate Go file (helper: [import-local-helper.ts](conformance/import-local-helper.ts)) |
290
- | Default export | ✅ | [syntax-default-export.ts](conformance/syntax-default-export.ts) | `export default function` |
291
- | Node.js built-in imports | ✅ | [lib-node-path.ts](conformance/lib-node-path.ts) | `node:x` or bare (`'fs'`), named / default / namespace imports, subpaths (`fs/promises`) (see [Node builtins](#node-builtins-node)) |
292
- | Go package imports | ✅ | [syntax-import-go.ts](conformance/syntax-import-go.ts) | `import { x } from 'go:pkg'` |
293
- | npm package imports | ✅ | [syntax-import-npm.ts](conformance/syntax-import-npm.ts) | `import { x } from 'pkg'` mapped to Go module imports |
294
- | Re-exports (`export { x } from`, `export *`) | ✅ | [syntax-re-exports.ts](conformance/syntax-re-exports.ts) | Re-exported files are included (one Go package) |
295
- | Dynamic `import()` | ✅ | [syntax-dynamic-import.ts](conformance/syntax-dynamic-import.ts) | `const m = await import('./x')` is a namespace import |
296
- | Side-effect imports (`import './mod'`) | ✅ | [syntax-side-effect-import.ts](conformance/syntax-side-effect-import.ts) | Module top-level statements run in Go's `init()` |
297
- | `import.meta.url` | ✅ | [syntax-import-meta.ts](conformance/syntax-import-meta.ts) | The `file://` URL of the running program (`os.Executable` → `pathToFileURL`) |
298
- | JSON modules (`import data from './x.json' with { type: 'json' }`) | ✅ | [lib-json-modules.ts](conformance/lib-json-modules.ts) | Read at compile time and compiled as an object literal, so fields keep their types (helper [json-module-helper.json](conformance/json-module-helper.json)); needs `resolveJsonModule` and a `module` setting that allows import attributes in a project tsconfig |
299
- | Per-module top-level scopes (same-named functions, consts, classes in two modules) | ✅ | [syntax-module-scope.ts](conformance/syntax-module-scope.ts) | Module-private names are made unique per module |
300
- | `Ns.T` of a namespace declared in another module | ✅ | [syntax-namespace-types-import.ts](conformance/syntax-namespace-types-import.ts) | `import type { Ns }` included |
301
-
302
- ## Async & timing
303
-
304
- | Feature | Status | Probe | Notes |
305
- | -------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
306
- | `async` / `await` | ✅ | [syntax-async-await.ts](conformance/syntax-async-await.ts) | The body runs synchronously until its first `await`; `await` runs pending event-loop tasks while it waits; the loop drains before exit |
307
- | Async arrow callbacks (`emitter.on('x', async () => { await … })`, `test('t', async () => …)`) | ✅ | [lib-node-test.ts](conformance/lib-node-test.ts) | Run to completion when called (their awaits keep the event loop running), so the caller sees them finish before it continues |
308
- | `Promise` constructor / `.then` | ✅ | [syntax-promise-then.ts](conformance/syntax-promise-then.ts) | The executor runs synchronously; promises are buffered channels; `.then` callbacks run on the event loop |
309
- | `Promise.all` | ✅ | [syntax-promise-all.ts](conformance/syntax-promise-all.ts) | `TnPromiseAll` drains every promise channel into a slice |
310
- | `Promise.resolve` | ✅ | [lib-promise-resolve.ts](conformance/lib-promise-resolve.ts) | Buffered channel holding the value |
311
- | `Promise.reject` / `.catch` / `.finally` | ✅ | [lib-promise-catch.ts](conformance/lib-promise-catch.ts) | Rejected promises are closed channels with a reason; `await` rethrows |
312
- | `Promise.race` / `allSettled` / `any` | ✅ | [lib-promise-combinators.ts](conformance/lib-promise-combinators.ts) | Goroutine per promise; first settled / all settled / first fulfilled |
313
- | `clearTimeout` | ✅ | [lib-timers.ts](conformance/lib-timers.ts) | `TnClearTimeout` stops the timer |
314
- | `setInterval` / `clearInterval` | ✅ | [lib-set-interval.ts](conformance/lib-set-interval.ts) | `time.Ticker` posting to the event loop; the process lives until cleared |
315
- | `queueMicrotask` | ✅ | [lib-queue-microtask.ts](conformance/lib-queue-microtask.ts) | Runs after the current synchronous code (end of main or of an event-loop task) |
316
- | `setTimeout` | ✅ | [lib-set-timeout.ts](conformance/lib-set-timeout.ts) | `time.AfterFunc` posting the callback to the event loop, which keeps the process alive |
317
- | `resolve` / `reject` passed as values | ✅ | [lib-node-async-hooks.ts](conformance/lib-node-async-hooks.ts) | `new Promise((resolve) => setTimeout(resolve, ms))` |
318
- | Async class methods (instance, static, inherited, unannotated); `return otherPromise()` | ✅ | [syntax-async-methods.ts](conformance/syntax-async-methods.ts) | Lowered like async functions; a returned promise is awaited |
319
- | `Promise.withResolvers` / `Promise.try` | ✅ | [lib-promise-extras.ts](conformance/lib-promise-extras.ts) | |
320
- | Async arrows kept as values (`const f = async () => …`) | ✅ | [lib-promise-extras.ts](conformance/lib-promise-extras.ts) | Return a promise like async functions (concise bodies too); async arrows passed straight to a call run inline (see above) |
321
- | `.then` on a `Promise.resolve(v)` held in a variable | ❌ | — | Compiles now (a goroutine waits on the channel and runs the callback); but `await p` consumes the value, so a `.then` registered before it never fires — one consumer per channel. Skip the `await`, or build it with `new Promise` |
322
- | Microtask order: `await` inside an async function nobody awaits; `.then` callbacks before a later `setTimeout(…, 0)` | ❌ | — | The function resumes synchronously and `.then` callbacks may run after the timer; await the call to get JS's order |
323
-
324
- ## Semantics (JS behaviour preserved)
325
-
326
- | Feature | Status | Probe | Notes |
327
- | --------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
328
- | Array reference semantics | ✅ | [semantics-array-reference.ts](conformance/semantics-array-reference.ts) | Array variables hold `*[]T` so aliases share the slice header |
329
- | `??` on an array reference (a missed `exec`, a `T[] \| null` result) | ✅ | [lib-nullish-array-ref.ts](conformance/lib-nullish-array-ref.ts) | A null result stays a nil reference (`TnSlicePtr`), so the fallback applies; an empty match `[]` is not null, and `exec(s)?.[i]` of a miss is `undefined` |
330
- | `any[]` arrays mutated through a parameter (`function f(a: any[]) { a.push(x) }`) | ✅ | [semantics-any-array-param.ts](conformance/semantics-any-array-param.ts) | An `any[]` is shared with the callee, so its `push` reaches the caller (a nested `any[]` element is still a copy) |
331
- | Arrays held in a `Map` / `Record` / array, mutated in place (`m.get(k)!.push(x)`) | ✅ | [semantics-container-array-push.ts](conformance/semantics-container-array-push.ts) | The element is an array reference (`*[]T`): a push reaches the container, also through a local alias; `getOrInsert` / `getOrInsertComputed` results too |
332
- | Object reference semantics | ✅ | [semantics-object-reference.ts](conformance/semantics-object-reference.ts) | Aliased objects share state; [semantics-parameter-mutation.ts](conformance/semantics-parameter-mutation.ts) |
333
- | Object identity | ✅ | [semantics-object-identity.ts](conformance/semantics-object-identity.ts) | Equal literals are different references |
334
- | Object key order | ✅ | [semantics-object-key-order.ts](conformance/semantics-object-key-order.ts) | Insertion order preserved |
335
- | Map insertion order | ✅ | [semantics-map-order.ts](conformance/semantics-map-order.ts) | Iteration follows insertion order |
336
- | Set insertion order | ✅ | [semantics-set-order.ts](conformance/semantics-set-order.ts) | Spread follows insertion order |
337
- | Default sort is lexicographic | ✅ | [semantics-default-sort.ts](conformance/semantics-default-sort.ts) | `[10, 9, 1].sort()` → `1,10,9` |
338
- | Float math | ✅ | [semantics-float-math.ts](conformance/semantics-float-math.ts) | `7 / 2 === 3.5`, `0.1 + 0.2 !== 0.3` |
339
- | Number to string (`String(n)`, templates, `JSON.stringify`) | ✅ | [semantics-number-to-string.ts](conformance/semantics-number-to-string.ts) | Plain notation from `1e-6` up to `1e21`, exponent form (`1e-7`, `1e+21`) outside it |
340
- | Integer precision | ✅ | [semantics-integer-precision.ts](conformance/semantics-integer-precision.ts) | `2 ** 53 + 1 === 2 ** 53` |
341
- | `NaN` semantics | ✅ | [semantics-nan.ts](conformance/semantics-nan.ts) | `NaN !== NaN`, `Number.isNaN(0 / 0)` |
342
- | String-number concatenation order | ✅ | [semantics-string-number-concat.ts](conformance/semantics-string-number-concat.ts) | `'a' + 1 + 2` vs `1 + 2 + 'a'` |
343
- | Array truthiness | ✅ | [semantics-array-truthy.ts](conformance/semantics-array-truthy.ts) | Empty array is truthy |
344
- | An object's own `length` field (`{ length: 3 }.length`) | ✅ | [semantics-length-field.ts](conformance/semantics-length-field.ts) | A field read, not an array length |
345
- | Loop closures capture per-iteration `let` | ✅ | [semantics-loop-closures.ts](conformance/semantics-loop-closures.ts) | |
346
- | Functions stored in Records | ✅ | [semantics-record-functions.ts](conformance/semantics-record-functions.ts) | `rec.fn()` → `rec.Get("fn")()`, also for names like `get` / `sort` |
347
- | An array field passed to a function or returned from one is the same array | ✅ | [semantics-shared-arrays.ts](conformance/semantics-shared-arrays.ts) | Callees get a `*[]T` reference to the field; `return n.sep ?? n.items` returns the field itself |
348
- | A local alias of an array field (`const a = o.items; a.push(x)`) | ✅ | [semantics-container-array-push.ts](conformance/semantics-container-array-push.ts) | The alias holds the field's reference, so pushes and splices reach the field |
349
- | An array read from an `any` object into a variable, then pushed to | ✅ | [semantics-any-array-alias.ts](conformance/semantics-any-array-alias.ts) | The read is the object's array: a push through the alias (`const l: any = o.list` or untyped) reaches the object, and the alias is the object's array. A typed-element alias (`o.list as number[]`) still holds a detached copy |
350
- | `null` in program data (`JSON.parse`, arrays and objects of `any`) is not `undefined` | ✅ | [semantics-json-null.ts](conformance/semantics-json-null.ts) | It prints, serializes and stringifies as `null`; `=== undefined` is false. A `null` stored in a typed slot is still Go `nil` |
351
- | Arrays are shared: an object field, a variable and a parameter holding one array see each other's changes | ✅ | [semantics-array-aliasing.ts](conformance/semantics-array-aliasing.ts) | An object type's array field is a reference (`*[]T`); a method returning its array argument returns that array |
352
- | Mutating array methods through `any` (`tok.tokens.unshift(…)`) reach the array's other holders | ✅ | [semantics-array-write-back.ts](conformance/semantics-array-write-back.ts) | Also `x?.[i]`, `x ?? []` and `x \|\| []` on an absent array, and a `Source[]` passed as `(Source \| Other)[]` (a converted copy) |
353
- | Object literals whose methods return the object (fluent builders), chained to any length | ✅ | [semantics-self-referencing-object.ts](conformance/semantics-self-referencing-object.ts) | Type inference is memoized per query, so long chains compile in linear time |
354
- | Key order of an `any`-typed object literal (`const o: any = { b: 1, a: 2 }`) | ✅ | [semantics-any-literal-key-order.ts](conformance/semantics-any-literal-key-order.ts) | An ordered record: `Object.keys`, `for-in`, `Object.entries` and `JSON.stringify` keep the source order; a typed (or inferred) literal keeps its order too |
355
- | `arr?.length` on an absent array | ✅ | [semantics-optional-array-length.ts](conformance/semantics-optional-array-length.ts) | Reads `undefined` (a nil array is not a zero-length array; a set-but-empty array reads `0`), so `?? fallback` applies |
356
-
357
- ## Sample apps
358
-
359
- End-to-end programs that combine many features the way real code does (they run in the suite like any probe).
360
-
361
- | App | Probe | Covers |
362
- | ------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
363
- | `wc`-style CLI | [app-cli-wordcount.ts](conformance/app-cli-wordcount.ts) | `util.parseArgs`, `fs`, `path`, `os.EOL`, a class with a `Map` field, tuples sorted with a `\|\|` comparator, `reduce` into an object, `crypto` |
364
- | JSON API on HTTP + SQLite | [app-http-sqlite.ts](conformance/app-http-sqlite.ts) | `http.createServer` routing, `URL`, `node:sqlite` prepared statements, `fetch` (POST / GET / DELETE), JSON bodies, status codes |
365
- | Stream pipeline | [app-stream-pipeline.ts](conformance/app-stream-pipeline.ts) | A generator through `Readable.from`, a CSV-aggregating `Transform`, `Float64Array` series, `stream/promises` `pipeline` to files, gzip and Brotli streams, SHA-256 |
366
- | Native window | [app-webview-window.ts](conformance/app-webview-window.ts) | A real `@webviewjs/webview` window whose page calls the program's own `http` server, then closes (runs with `TN_WEBVIEW_SMOKE=1`) |
367
-
368
- ## Examples
369
-
370
- The programs in [examples/](examples/) show where a native binary beats Node.js, each with a benchmark. They
371
- take arguments or keep running, so the suite type-checks and builds them as `example-<name>` without running
372
- them (`node scripts/conformance.mjs example`).
373
-
374
- | Example | Source | Covers |
375
- | ------------------------------------------------ | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
376
- | [hello-world](examples/hello-world/) | [main.ts](examples/hello-world/main.ts) | `process.argv`, template literals: process startup |
377
- | [fibonacci](examples/fibonacci/) | [main.ts](examples/fibonacci/main.ts) | Recursion, `perf_hooks`: CPU-bound compute |
378
- | [json-server](examples/json-server/) | [main.ts](examples/json-server/main.ts) | `node:http` GET / POST JSON routes, `URL`: HTTP throughput |
379
- | [todo-cli](examples/todo-cli/) | [main.ts](examples/todo-cli/main.ts) | `process.argv` destructuring with default and rest, `fs` atomic writes (`renameSync`), `os.homedir()`, `process.env`: per-command latency |
380
- | [dupe-finder](examples/dupe-finder/) | [main.ts](examples/dupe-finder/main.ts) | Recursive `readdirSync` with `withFileTypes`, `statSync`, SHA-256 `createHash`, `Map` grouping, JSON report to disk: disk scan + hashing |
381
- | [mandelbrot-png](examples/mandelbrot-png/) | [main.ts](examples/mandelbrot-png/main.ts) | Float loop, tuple returns, `Uint8Array` / `DataView`, a PNG encoder on `zlib.deflateSync` + `zlib.crc32`: image rendering with no deps |
382
- | [desktop-notes](examples/desktop-notes/) | [main.ts](examples/desktop-notes/main.ts), [ui.ts](examples/desktop-notes/ui.ts) | `node:http` REST routes, `fs` note files, UI compiled in from a `.ts` module, `@webviewjs/webview` window (own process under Node.js): launch time + memory |
383
- | [yaml-cli](examples/yaml-cli/) | [main.ts](examples/yaml-cli/main.ts) | The `yaml` package's own CLI from its unmodified source: `Worker` threads, `PassThrough`, `fs/promises`, `process.stdin`: per-call latency + throughput |
384
- | [marked-cli](examples/marked-cli/) | [main.ts](examples/marked-cli/main.ts) | The `marked` CLI from its unmodified source: `worker_threads`, `zlib` gzip / gunzip, `fs/promises`, `process.stdin`: per-call latency + throughput |
385
- | [openai-chat](examples/openai-chat/) | [main.ts](examples/openai-chat/main.ts) | Streaming `fetch` with an SSE parser over `ReadableStream` / `TextDecoder`, `readline/promises` REPL, `AbortController`, `SIGINT`: time to answer |
386
- | [angular-templates](examples/angular-templates/) | [main.ts](examples/angular-templates/main.ts) | `@angular/compiler` (233 vendored files) from its unmodified source: deep class hierarchies and `super`, generators, structural object types, `bigint`, `Map` / `Set`: per-template compile |
387
- | [react-compiler](examples/react-compiler/) | [main.ts](examples/react-compiler/main.ts) | The React Compiler on Babel 7.29 + zod 4 (~470 vendored files), JSX / TS parsing, `child_process` workers: per-file compile |
388
-
389
- ## Standard library
390
-
391
- Every standard-library API TypeNative ports, split by module. Per
392
- [types/typenative-npm.d.ts](types/typenative-npm.d.ts) (`node:*`) and
393
- [types/typenative-go.d.ts](types/typenative-go.d.ts) (`go:*`).
394
-
395
- The reference runtime is Node 26 (V8 14.6). Notes that start with **Node 25** or
396
- **Node 26** mark APIs added, changed or removed since Node 24, the previous
397
- baseline, and name the release that changed them. Experimental modules that
398
- still need a flag in Node 26 (`node:vfs`, `node:bench`, `node:dtls`,
399
- `node:stream/iter`, the global `Worker`) aren't tracked until they ship
400
- unflagged.
401
-
402
- ### `console`
403
-
404
- | API | Status | Probe | Notes |
405
- | ----------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------- |
406
- | `console.log` | ✅ | [lib-console-log.ts](conformance/lib-console-log.ts) | `fmt.Println`; non-string arguments print like Node (`util.inspect`), format strings like `util.format` |
407
- | `console.error` | ✅ | [lib-console-error.ts](conformance/lib-console-error.ts) | `fmt.Fprintln(os.Stderr, ...)` |
408
- | `console.warn` | ✅ | [lib-console-error.ts](conformance/lib-console-error.ts) | Mapped to stderr like `console.error` |
409
- | `console.time` / `console.timeEnd` / `console.timeLog` | ✅ | [lib-console-time.ts](conformance/lib-console-time.ts) | Node's format: `label: 1.234ms` |
410
- | `console.info` / `debug` / `dir` / `count` / `countReset` / `group` / `groupEnd` / `assert` / `trace` | ✅ | [lib-console-more.ts](conformance/lib-console-more.ts) | `group` indents every later console line; `assert` prints `Assertion failed` |
411
- | `console.table` (arrays, objects, `Map`, `Set`, a `properties` filter) | ✅ | [lib-node-console-table.ts](conformance/lib-node-console-table.ts) | Node's box-drawn layout (left-aligned cells); other values are logged as is |
412
-
413
- ### `Math`
414
-
415
- | API | Status | Probe | Notes |
416
- | ----------------------------------------------------------------------------- | :----: | -------------------------------------------------------------- | ----------------------------------------------------------- |
417
- | `Math.floor` / `ceil` / `round` | ✅ | [lib-math.ts](conformance/lib-math.ts) | Mapped to `math.Floor`, `math.Ceil`, `math.Round` |
418
- | `Math.abs` / `sqrt` / `pow` | ✅ | [lib-math.ts](conformance/lib-math.ts) | Mapped to corresponding `math` functions |
419
- | `Math.min` / `Math.max` | ✅ | [lib-math-min-max.ts](conformance/lib-math-min-max.ts) | Go builtins `min` / `max` |
420
- | `Math.max(...arr)` / spread & variadic | ✅ | [lib-math-min-max.ts](conformance/lib-math-min-max.ts) | Spread and any number of arguments via `slices.Max` / `max` |
421
- | `Math.random` | ✅ | [lib-math-random.ts](conformance/lib-math-random.ts) | Mapped to `rand.Float64()` |
422
- | `Math.log` / `log2` / `log10` | ✅ | [lib-math-functions.ts](conformance/lib-math-functions.ts) | `math.Log` / `math.Log2` / `math.Log10` |
423
- | `Math.sin` / `cos` / `tan` | ✅ | [lib-math-functions.ts](conformance/lib-math-functions.ts) | `math.Sin` / `math.Cos` / `math.Tan` |
424
- | `Math.trunc` / `sign` | ✅ | [lib-math-functions.ts](conformance/lib-math-functions.ts) | `math.Trunc` / inline sign check |
425
- | Constants (`Math.PI`, `Math.E`, …) | ✅ | [lib-math-constants.ts](conformance/lib-math-constants.ts) | `math.Pi`, `math.E`, `math.Sqrt2`, … |
426
- | `Math.asin` / `acos` / `atan` / `atan2` / `hypot` / `cbrt` / `exp` | ✅ | [lib-math-more.ts](conformance/lib-math-more.ts) | Corresponding `math` functions |
427
- | `Math.sinh` / `cosh` / `tanh` / `expm1` / `log1p` | ✅ | [lib-math-hyperbolic.ts](conformance/lib-math-hyperbolic.ts) | Corresponding `math` functions |
428
- | `Math.fround` / `imul` / `clz32` / `asinh` / `acosh` / `atanh` / `sumPrecise` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | `sumPrecise` is a compensated (Neumaier) sum |
429
- | `Math.f16round` | ✅ | [lib-es2025-statics.ts](conformance/lib-es2025-statics.ts) | Rounds to the nearest binary16 (ties to even) directly from float64 |
430
-
431
- ### `JSON`
432
-
433
- | API | Status | Probe | Notes |
434
- | ----------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
435
- | `JSON.parse` | ✅ | [lib-json-parse.ts](conformance/lib-json-parse.ts) | Mapped to `encoding/json` `Unmarshal`; assigned to an interface type, the result converts into its struct |
436
- | `JSON.stringify` | ✅ | [lib-json-stringify.ts](conformance/lib-json-stringify.ts) | Reflection serializer includes unexported struct fields and inherited ones |
437
- | `JSON.stringify` `space`, replacer (function or key list), `toJSON()`; circular structures; `JSON.parse` reviver and `SyntaxError`s | ✅ | [lib-json-options.ts](conformance/lib-json-options.ts) | Node's layout; Dates serialize as ISO strings, `Map` / `Set` as `{}`, bigints throw. A replacer or reviver returning `undefined` gives `null` (it doesn't drop the key) |
438
- | Key order of `JSON.parse` objects | ✅ | [lib-object-keys-typed.ts](conformance/lib-object-keys-typed.ts) | Parsed objects are ordered records (a duplicate key keeps its first position and last value); `delete`, `in`, `for...in` and spreads keep the order |
439
-
440
- ### `Object`
441
-
442
- | API | Status | Probe | Notes |
443
- | ------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
444
- | `Object.keys` / `values` / `entries` | ✅ | [lib-object-helpers.ts](conformance/lib-object-helpers.ts) | Map key/value iteration helpers; typed results for maps and records |
445
- | `Object.keys` / `values` / `entries`, `for...in` on typed objects (interfaces, object literals, class instances) | ✅ | [lib-object-keys-typed.ts](conformance/lib-object-keys-typed.ts) | Own data fields in declaration order, a parent class's first; no `#private` fields or accessors (they are on the prototype); unset optional properties are absent |
446
- | `Object.assign` | ✅ | [lib-object-assign.ts](conformance/lib-object-assign.ts) | Sources (structs, maps, dynamic objects) copied into an ordered map |
447
- | `Object.freeze` / `seal` / `preventExtensions` / `isFrozen` / `isSealed` / `isExtensible` | ✅ | [lib-object-freeze.ts](conformance/lib-object-freeze.ts) | Integrity level tracked by identity; writes rejected by `Readonly<T>` types (`preventExtensions` / `isSealed` / `isExtensible` not probed) |
448
- | `Object.fromEntries` | ✅ | [lib-object-from-entries.ts](conformance/lib-object-from-entries.ts) | `TnFromEntries` → dynamic object |
449
- | `Object.hasOwn` / `defineProperty` / `getOwnPropertyNames` | ✅ | [lib-object-own.ts](conformance/lib-object-own.ts) | Maps, dynamic objects and typed objects (literal keys); `{ value }` descriptors |
450
- | `Object.hasOwn` / `defineProperty` with a non-literal key on a typed object | ✅ | [lib-object-own-computed.ts](conformance/lib-object-own-computed.ts) | A `switch` over the declared fields (an unset optional field is not own) |
451
- | `Object.is` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | SameValue; two empty object literals may share an address in Go, so `Object.is({}, {})` can be `true` |
452
- | `Object.groupBy` / `Map.groupBy` | ✅ | [lib-group-by.ts](conformance/lib-group-by.ts) | Groups in first-seen key order |
453
- | `Object.create(null)` | ✅ | [lib-object-create-null.ts](conformance/lib-object-create-null.ts) | An empty dynamic object (the prototype-less dictionary idiom) |
454
- | `Object.create(C.prototype)` / `getPrototypeOf` / `getOwnPropertyDescriptors` / `defineProperties` | ✅ | [lib-object-create-proto.ts](conformance/lib-object-create-proto.ts) | Class values stand in for prototypes: an instance without its constructor run (unset fields are zero values); `getPrototypeOf` gives the class |
455
- | `Object.assign` keeps types: a typed target updated in place, `Object.assign({}, typed, { overrides })` a copy of the same type | ✅ | [syntax-object-assign-typed.ts](conformance/syntax-object-assign-typed.ts) | Function fields and methods are copied; an explicit `undefined` override clears the field |
456
- | Integer-like keys of plain objects listed first, ascending | ✅ | [lib-object-key-order.ts](conformance/lib-object-key-order.ts) | `Object.keys`, `JSON.stringify` and `for…in`; Maps keep plain insertion order |
457
- | `Object.defineProperty(this, k, { value, writable })` in a constructor | ✅ | [lib-object-define-property.ts](conformance/lib-object-define-property.ts) | Sets the field (or the record entry) |
458
- | A `Record` built from an object's spread; an object stored where a `Record` is expected and read back | ✅ | [lib-record-spread-objects.ts](conformance/lib-record-spread-objects.ts) | A parameter may shadow a Node import of the same name |
459
-
460
- ### `String`
461
-
462
- | API | Status | Probe | Notes |
463
- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
464
- | Template literals | ✅ | [syntax-template-literals.ts](conformance/syntax-template-literals.ts) | Backtick strings with `${expr}` interpolation |
465
- | Tagged templates | ✅ | [syntax-tagged-templates.ts](conformance/syntax-tagged-templates.ts) | Desugared to `tag([...strings], ...values)` |
466
- | `toUpperCase` / `toLowerCase` | ✅ | [lib-string-basics.ts](conformance/lib-string-basics.ts) | Via `strings` package |
467
- | `trim` / `trimStart` / `trimEnd` | ✅ | [lib-string-basics.ts](conformance/lib-string-basics.ts) | Via `strings` package |
468
- | `split` / `join` | ✅ | [lib-string-split-join.ts](conformance/lib-string-split-join.ts) | Via `strings` package |
469
- | `includes` / `startsWith` / `endsWith` / `indexOf` (with `fromIndex`) | ✅ | [lib-string-search.ts](conformance/lib-string-search.ts) | Via `strings` package |
470
- | `replace` / `replaceAll` (string pattern) | ✅ | [lib-string-replace.ts](conformance/lib-string-replace.ts) | Via `strings` package |
471
- | `replace` / `replaceAll` (RegExp, `$1`/`$&`, fn replacer) | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | `/g` vs first match, `$1`/`$&` patterns, function replacers |
472
- | `charAt` / `substring` / `slice` | ✅ | [lib-string-slice.ts](conformance/lib-string-slice.ts) | Direct Go string indexing/slicing |
473
- | `charCodeAt` / `String.fromCharCode` | ✅ | [lib-string-char-codes.ts](conformance/lib-string-char-codes.ts) | `charCodeAt` reads the byte; `String.fromCharCode` → `string(rune(n))` |
474
- | `concat` / `repeat` | ✅ | [lib-string-pad-repeat.ts](conformance/lib-string-pad-repeat.ts) | Concatenation and `strings.Repeat` |
475
- | `padStart` / `padEnd` | ✅ | [lib-string-pad-repeat.ts](conformance/lib-string-pad-repeat.ts) | Via `strings.Repeat` |
476
- | `localeCompare` | ✅ | [lib-string-compare.ts](conformance/lib-string-compare.ts) | `strings.Compare` → -1/0/1: code-unit order, not locale-aware |
477
- | `match` / `matchAll` / `search` | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Via `regexp` package (`String.match` with groups) |
478
- | `at` (negative indices) | ✅ | [lib-array-at.ts](conformance/lib-array-at.ts) | Supports negative indices |
479
- | Unicode length / iteration | ✅ | [lib-string-unicode.ts](conformance/lib-string-unicode.ts) | `.length` counts runes; `[...str]` spreads runes |
480
- | `String.raw` | ✅ | [lib-string-raw.ts](conformance/lib-string-raw.ts) | Raw template text with values interpolated |
481
- | `normalize` | ✅ | [lib-string-normalize.ts](conformance/lib-string-normalize.ts) | `golang.org/x/text/unicode/norm`, copied from GOROOT's vendor tree (offline) |
482
- | `split(sep, limit)` / `lastIndexOf(s, fromIndex)` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | |
483
- | `localeCompare(s, locales, options)` | ✅ | [lib-locale-compare-format.ts](conformance/lib-locale-compare-format.ts) | With a locale or options, `Intl.Collator` (CLDR collation via `golang.org/x/text/collate`: `sensitivity`, `numeric`, `caseFirst`, `ignorePunctuation`); a bare `a.localeCompare(b)` keeps a light root-collation approximation (spaces and punctuation, digits, letters; then accents, then case) so sorting programs don't link the tables |
484
- | `codePointAt` / `String.fromCodePoint` / `substr` / `trimLeft` / `trimRight` / `isWellFormed` / `toWellFormed` / `toLocaleUpperCase` / `toLocaleLowerCase` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | `codePointAt` past the end is `NaN` (JS: `undefined`); the locale variants apply tr / az / lt casing ([lib-intl-to-locale-string.ts](conformance/lib-intl-to-locale-string.ts)) |
485
- | Positions in non-ASCII text (length, indexing, `indexOf`, `slice`, regex `index` / `lastIndex`) | ✅ | [lib-string-code-points.ts](conformance/lib-string-code-points.ts) | Every API counts the same units: one per character in the BMP (code points beyond it count once, not as two UTF-16 units) |
486
- | `replace` with a `string \| RegExp` pattern, a function value as the replacer, `undefined` groups, an offset parameter | ✅ | [lib-string-replace-forms.ts](conformance/lib-string-replace-forms.ts) | |
487
- | `toUpperCase` / `toLowerCase` as JS maps case | ✅ | [lib-string-case-mapping.ts](conformance/lib-string-case-mapping.ts) | `ß` → `SS`, `fi` → `FI`, `İ` → `i̇`, `ẞ` → `ß`, final `ς` |
488
- | `split(sep, limit)` (string and RegExp separators); `trim` / `trimStart` / `trimEnd`; strings built with `+=` in a loop | ✅ | [lib-string-split-trim.ts](conformance/lib-string-split-trim.ts) | Trims JS whitespace (U+0085 and U+200B are not); loop accumulators are `strings.Builder`s, so building a long string is linear |
489
-
490
- ### `Array`
491
-
492
- | API | Status | Probe | Notes |
493
- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------- |
494
- | `push` / `pop` | ✅ | [lib-array-push-pop.ts](conformance/lib-array-push-pop.ts) | Basic stack operations |
495
- | `shift` / `unshift` | ✅ | [lib-array-shift-unshift.ts](conformance/lib-array-shift-unshift.ts) | Queue operations |
496
- | `join` / `reverse` | ✅ | [lib-array-reverse-join.ts](conformance/lib-array-reverse-join.ts) | `join()` defaults to `","`; `reverse` reverses in place and returns the array |
497
- | `toString()` / `String(arr)` / `` `${arr}` `` | ✅ | [syntax-array-to-string.ts](conformance/syntax-array-to-string.ts) | Elements joined with `,` (nested arrays flatten) |
498
- | `slice` | ✅ | [lib-array-slice.ts](conformance/lib-array-slice.ts) | Negative indices count from the end |
499
- | `splice` | ✅ | [lib-array-splice.ts](conformance/lib-array-splice.ts) | Removes and returns elements in place, inserting extra arguments |
500
- | `sort` (default, lexicographic) | ✅ | [semantics-default-sort.ts](conformance/semantics-default-sort.ts) | String sort by default |
501
- | `sort` (comparator) | ✅ | [lib-array-sort-comparator.ts](conformance/lib-array-sort-comparator.ts) | Comparator lowered into `sort.SliceStable` |
502
- | `flat` / `flatMap` | ✅ | [lib-array-flat-flatmap.ts](conformance/lib-array-flat-flatmap.ts) | One-level `flat`; `flatMap` appends callback results |
503
- | `at` | ✅ | [lib-array-at.ts](conformance/lib-array-at.ts) | Supports negative indices |
504
- | `fill` | ✅ | [lib-array-fill.ts](conformance/lib-array-fill.ts) | `new Array<T>(n)` → `make([]T, n)`; `fill` assigns in place |
505
- | `Array.from` | ✅ | [lib-array-from.ts](conformance/lib-array-from.ts) | Array-likes read `length`; the callback gets the index |
506
- | `Array.isArray` | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Type check on values |
507
- | `map` / `filter` / `reduce` | ✅ | [lib-array-map-filter-reduce.ts](conformance/lib-array-map-filter-reduce.ts) | Incl. chaining and object arrays |
508
- | `some` / `every` | ✅ | [lib-array-some-every.ts](conformance/lib-array-some-every.ts) | Predicate quantifiers |
509
- | `find` / `findIndex` / `findLast` / `findLastIndex` | ✅ | [lib-array-find.ts](conformance/lib-array-find.ts) | `findLast`/`findLastIndex` search from the end |
510
- | `forEach` | ✅ | [lib-map-iteration.ts](conformance/lib-map-iteration.ts) | Block-body callbacks; `Map.forEach` |
511
- | `includes` / `indexOf` / `lastIndexOf` | ✅ | [lib-array-search.ts](conformance/lib-array-search.ts) | `lastIndexOf` searches from the end |
512
- | `entries` / `keys` / `values` | ✅ | [lib-array-entries.ts](conformance/lib-array-entries.ts) | `[index, value]` pairs destructured in `for...of` |
513
- | `length` truncation (`arr.length = 0`) | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Clear via length assignment |
514
- | `filter(Boolean)` | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Constructor as predicate |
515
- | `concat` | ✅ | [lib-array-concat.ts](conformance/lib-array-concat.ts) | Arrays flattened one level, values appended |
516
- | `reduceRight` | ✅ | [lib-array-reduce-right.ts](conformance/lib-array-reduce-right.ts) | `reduce` over a reversed copy |
517
- | `copyWithin` | ✅ | [lib-array-copy-within.ts](conformance/lib-array-copy-within.ts) | Go `copy` (overlap-safe) |
518
- | Change-preserving copies (`toSorted` / `toReversed` / `with`) | ✅ | [lib-array-copies.ts](conformance/lib-array-copies.ts) | Clone, then sort / reverse / set |
519
- | `toSpliced` | ✅ | [lib-array-to-spliced.ts](conformance/lib-array-to-spliced.ts) | `slices.Concat` of the kept parts |
520
- | `Array.of` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | |
521
- | Iterator helpers on generators (`map` / `filter` / `flatMap` / `take` / `drop` / `toArray` / `forEach` / `some` / `every` / `find` / `reduce`), `Iterator.from(array)` | ✅ | [lib-iterator-helpers.ts](conformance/lib-iterator-helpers.ts) | Lazy (works on infinite generators): one goroutine per stage |
522
- | `Array.fromAsync` | ✅ | [lib-array-from-async.ts](conformance/lib-array-from-async.ts) | Async iterables, arrays of promises or values, with a sync or async `mapFn` |
523
- | `Iterator.concat(...iterables)` | ✅ | [lib-es2025-statics.ts](conformance/lib-es2025-statics.ts) | Arrays and generators, one after another |
524
- | `[...map.keys()]` / `[...map.values()]` | ✅ | [lib-group-by.ts](conformance/lib-group-by.ts) | |
525
- | `anyArray.concat([…])` with an array of another element type (`xs.concat(['x'])` on `any[]`) | ✅ | [lib-locale-compare-format.ts](conformance/lib-locale-compare-format.ts) | A typed array argument is spread element by element, on `any[]` and on `any` values |
526
-
527
- ### `Map` / `Set`
528
-
529
- | API | Status | Probe | Notes |
530
- | ------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
531
- | `Map` (`set` / `get` / `has` / `delete` / `size`) | ✅ | [lib-map.ts](conformance/lib-map.ts) | `Map<K, V>` → Go `map[K]V`; constructor with entries |
532
- | `Map` iteration (`for...of`, destructuring) | ✅ | [lib-map-iteration.ts](conformance/lib-map-iteration.ts) | Key/value iteration, `Object.entries()` unwrapping |
533
- | `Set` (`add` / `has` / `delete` / `size`) | ✅ | [lib-set.ts](conformance/lib-set.ts) | `Set<T>` → Go `map[T]struct{}`; constructor with values |
534
- | `Set` iteration / spread | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | `for...of`, `[...set]` |
535
- | `Map.clear` / `Set.clear` | ✅ | [lib-map-clear.ts](conformance/lib-map-clear.ts) | `TnMap.Clear()` |
536
- | `WeakMap` / `WeakSet` | ✅ | [lib-weak-collections.ts](conformance/lib-weak-collections.ts) | Same as `Map` / `Set` (weakness is not observable) |
537
- | Set operations (`union` / `intersection` / `difference`) | ✅ | [lib-set-operations.ts](conformance/lib-set-operations.ts) | Plus `symmetricDifference` / `isSubsetOf` / `isSupersetOf` / `isDisjointFrom` |
538
- | `Map` / `WeakMap` `getOrInsert(key, value)` / `getOrInsertComputed(key, fn)` | ✅ | [lib-map-upsert.ts](conformance/lib-map-upsert.ts) | One lookup, then a store when the key is missing; arrays and objects are returned by reference |
539
- | `new Map(iterable)` / `new Set(iterable)` from Maps, iterators, generators, `Object.entries`, strings, `null` | ✅ | [lib-collection-constructors.ts](conformance/lib-collection-constructors.ts) | A Map copy keeps the source's key and value types; plain objects and arrays as keys / members are compared by identity |
540
-
541
- ### `Number`
542
-
543
- | API | Status | Probe | Notes |
544
- | -------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------- | ------------------------------------------------------------------- |
545
- | `toString` (incl. radix) | ✅ | [lib-number-format.ts](conformance/lib-number-format.ts) | Universal `toString()` via `fmt.Sprintf` for any type |
546
- | `toFixed` | ✅ | [lib-number-format.ts](conformance/lib-number-format.ts) | `n.toFixed(2)` via `strconv.FormatFloat` |
547
- | `parseInt` / `parseFloat` / `Number()` | ✅ | [lib-number-parse.ts](conformance/lib-number-parse.ts) | Mapped to Go's `strconv` package |
548
- | `Number.isInteger` / `isNaN` / `MAX_SAFE_INTEGER` | ✅ | [lib-number-checks.ts](conformance/lib-number-checks.ts) | Number predicates and constants |
549
- | `Number.MIN_SAFE_INTEGER` / `MAX_VALUE` | ✅ | [lib-number-limits.ts](conformance/lib-number-limits.ts) | |
550
- | `Number.EPSILON` / `isFinite` / `toPrecision` | ✅ | [lib-number-misc.ts](conformance/lib-number-misc.ts) | `toPrecision` → `strconv.FormatFloat(x, 'g', n, 64)` |
551
- | `String()` / `Boolean()` conversions | ✅ | [lib-conversions.ts](conformance/lib-conversions.ts) | JS formatting / truthiness |
552
- | `toExponential` / `Number.isSafeInteger` / `parseInt` / `parseFloat` / `MIN_VALUE` / `NEGATIVE_INFINITY` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | |
553
- | Number / BigInt `toLocaleString` | ✅ | [lib-intl-to-locale-string.ts](conformance/lib-intl-to-locale-string.ts) | Through `Intl.NumberFormat` (every option); without locales, the system locale, as in Node |
554
- | `toFixed` rounding ties away from zero, ≥ 1e21, on `any` values and in callbacks | ✅ | [lib-number-to-fixed.ts](conformance/lib-number-to-fixed.ts) | `(1.25).toFixed(1)` is `"1.3"` (Go's formatter rounds ties to even) |
555
-
556
- ### `Date`
557
-
558
- | API | Status | Probe | Notes |
559
- | ----------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
560
- | `new Date()` / `getTime` / `toISOString` | ✅ | [lib-date.ts](conformance/lib-date.ts) | `new Date(ms)` → `time.UnixMilli`; `getTime`/`toISOString` mapped to `time.Time` |
561
- | `Date.now()` | ✅ | [lib-date-now.ts](conformance/lib-date-now.ts) | `time.Now().UnixMilli()` |
562
- | Component getters (`getFullYear`, `getMonth`, …) | ✅ | [lib-date-getters.ts](conformance/lib-date-getters.ts) | Local and `getUTC*` getters, `Date.UTC` |
563
- | `toJSON` / `valueOf`; Invalid Dates (`getTime()` is `NaN`, `toISOString` throws a `RangeError`) | ✅ | [lib-date-parse-set.ts](conformance/lib-date-parse-set.ts) | |
564
- | `toString` / `toDateString` / `toTimeString` / `toUTCString`, `String(date)`, `` `${date}` `` | ✅ | [lib-date-parse-set.ts](conformance/lib-date-parse-set.ts) | Node's formats in the local zone; long zone names for common zones (`Coordinated Universal Time`, `Central European Standard Time`, …), `GMT±hh:mm` otherwise |
565
- | `new Date(string)` / `new Date(y, m, d, …)` / `new Date(date)` / `Date.parse` | ✅ | [lib-date-parse-set.ts](conformance/lib-date-parse-set.ts) | ISO strings (date-only UTC, date-times local unless offset) and the formats `toString` / `toUTCString` / common `Month D, YYYY` and `YYYY/MM/DD` forms produce; an unparsable string is an Invalid Date |
566
- | Setters (`setFullYear`, `setDate`, `setHours`, … and `setUTC*`), `setTime`, `getTimezoneOffset` | ✅ | [lib-date-parse-set.ts](conformance/lib-date-parse-set.ts) | Fields overflow like JS. Dates are values: a setter updates the variable or field it is called on, not other references to the same Date |
567
- | `toLocaleDateString` / `toLocaleTimeString` / `toLocaleString` | ✅ | [lib-intl-to-locale-string.ts](conformance/lib-intl-to-locale-string.ts) | Through `Intl.DateTimeFormat` (locales, styles, fields, `timeZone`); without locales, the system locale and time zone, as in Node |
568
- | Date arithmetic and ordering (`b - a`, `+d`, `a < b`) | ✅ | [semantics-date-arithmetic.ts](conformance/semantics-date-arithmetic.ts) | The time value in milliseconds; `any` operands of `-` `*` `/` `%` convert with ToNumber |
569
-
570
- ### `RegExp`
571
-
572
- | API | Status | Probe | Notes |
573
- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
574
- | Regex literals | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | `/pattern/flags` run on the regex VM, compiled once per pattern and flags |
575
- | `new RegExp()` | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | Constructor with optional flags |
576
- | `test()` | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | Matches without building the groups |
577
- | `exec()` (groups) | ✅ | [lib-regex-groups.ts](conformance/lib-regex-groups.ts) | A match array; a group that took no part is `undefined` |
578
- | Flags (`i`, `m`) | ✅ | [lib-regex-flags.ts](conformance/lib-regex-flags.ts) | Case-insensitive, multiline |
579
- | Backreferences | ✅ | [lib-regex-backreference.ts](conformance/lib-regex-backreference.ts) | By number and by name, on the regex VM |
580
- | Named groups | ✅ | [lib-regex-named-groups.ts](conformance/lib-regex-named-groups.ts) | `(?<name>` → `(?P<name>`; `exec` returns a match with `.groups` |
581
- | Global `exec` loop (`/g` + `lastIndex`) | ✅ | [lib-regex-global-exec.ts](conformance/lib-regex-global-exec.ts) | /g regexes carry `lastIndex` state in the `TnRegex` wrapper |
582
- | Lookbehind | ✅ | [lib-regex-lookbehind.ts](conformance/lib-regex-lookbehind.ts) | Lookaround runs on the regex VM |
583
- | Remaining flags (`s` / `u` / `y`) & `source` / `flags` | ✅ | [lib-regex-more-flags.ts](conformance/lib-regex-more-flags.ts) | Sticky matching, `\u{…}` escapes, `lastIndex` / `source` / `flags` / flag getters |
584
- | `split` with RegExp | ✅ | [lib-regex-split.ts](conformance/lib-regex-split.ts) | JS semantics: captures are included, `limit` counts items |
585
- | Match `.index` (`exec` / `match` / `matchAll`), `match` with `/g` | ✅ | [lib-regex-index-split.ts](conformance/lib-regex-index-split.ts) | Character index kept in a hidden slot of the match array; `search` counts characters |
586
- | Unicode property escapes (`\p{L}`) with `u` | ✅ | [lib-regex-engine.ts](conformance/lib-regex-engine.ts), [lib-regex-escapes.ts](conformance/lib-regex-escapes.ts) | Only with `u` or `v`, as in JS |
587
- | Backtracking semantics (capture reset, empty loops, line terminators, `[]`) | ✅ | [lib-regex-engine.ts](conformance/lib-regex-engine.ts) | Expected values checked against Node; a pattern that explodes switches to RE2 when RE2 can run it |
588
- | Long strings: slices, indexes, `+=` | ✅ | [lib-string-long-slices.ts](conformance/lib-string-long-slices.ts) | Code-point offsets in long and non-ASCII strings; `+=` on a dynamic value keeps earlier values intact |
589
- | Fields of dynamic objects | ✅ | [semantics-dynamic-field-access.ts](conformance/semantics-dynamic-field-access.ts)| Reads stay copies across later writes; setters, `switch` tags, in-place `push`, `Object.assign` |
590
- | `d` flag `indices` / `hasIndices`; `RegExp.escape` | ✅ | [lib-regexp-indices.ts](conformance/lib-regexp-indices.ts), [lib-es2025-statics.ts](conformance/lib-es2025-statics.ts) | `indices` gives each group's `[start, end]` in code points (`undefined` for a group that did not match); `indices.groups` is not set |
591
- | `v` flag (`unicodeSets`): class subtraction `--`, intersection `&&`, nested and negated classes, `\q{…}` strings, `i` folding each operand; `unicodeSets` property | ✅ | [lib-regex-unicode-sets.ts](conformance/lib-regex-unicode-sets.ts) | Strings are tried longest first, as in JS; properties of strings (`\p{RGI_Emoji}`) aren't supported |
592
- | Unmatched groups are `undefined`; sticky (`y`) regexes; lookaround captures; `$&` / `` $` `` / `$'` / `$<name>` / `$$` replacements; replacer offsets | ✅ | [lib-regex-groups-replace.ts](conformance/lib-regex-groups-replace.ts) | `new RegExp(src, 'g')` keeps its flags. An unmatched group still reads as `''` in string comparisons other than `=== undefined` |
593
- | JS escapes in every pattern, also those the backtracking engine runs (backreferences, lookaround): `\xHH`, `\uHHHH`, `\u{…}`, `\cJ`, `\p{…}` / `\P{…}`, `\k<name>`; `\s` as JS's Unicode whitespace | ✅ | [lib-regex-escapes.ts](conformance/lib-regex-escapes.ts) | Group numbers count opening parentheses, as in JS |
594
- | RegExp values: in objects, passed around, built at run time (`new RegExp(src, 'g')`), called through `any`; an object cast to `RegExp` | ✅ | [lib-regex-values.ts](conformance/lib-regex-values.ts) | `Object.prototype.toString.call(re)` |
595
- | Unmatched groups stay `undefined` through a `const`, a conditional and a `string` field (left out of JSON); `xs[i]` past the end into `any` | ✅ | [lib-regex-unmatched-groups.ts](conformance/lib-regex-unmatched-groups.ts) | Such a field is an any field |
596
-
597
- ### `Promise` / timers
598
-
599
- See [Async & timing](#async--timing): `Promise` (constructor, `.then` / `.catch` / `.finally`,
600
- `resolve` / `reject` / `all` / `race` / `allSettled` / `any`), `setTimeout`, `setInterval`,
601
- `queueMicrotask` and their `clear*` functions, plus the gaps.
602
-
603
- ### Misc globals
604
-
605
- | API | Status | Probe | Notes |
606
- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
607
- | `assert` | ✅ | [lib-console-log.ts](conformance/lib-console-log.ts) | Transpiled to `panic` on failure |
608
- | `process.argv` / `process.platform` | ✅ | [lib-process.ts](conformance/lib-process.ts) | Node's shapes (`[execPath, script, ...args]`, `win32`); the rest of `process` is in [node:process](#nodeprocess) |
609
- | `process.env` | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Environment variable access |
610
- | `process.exit` | ✅ | [lib-process-exit.ts](conformance/lib-process-exit.ts) | `os.Exit`, after `process.on('exit')` listeners |
611
- | `process.cwd()` | ✅ | [lib-process-cwd.ts](conformance/lib-process-cwd.ts) | `os.Getwd()` |
612
- | `Buffer` / `Uint8Array` / `TextEncoder` / `TextDecoder` / `atob` / `btoa` | ✅ | [lib-node-buffer-encodings.ts](conformance/lib-node-buffer-encodings.ts) | See [node:buffer](#nodebuffer) |
613
- | `URL` / `URLSearchParams` | ✅ | [lib-node-url-class.ts](conformance/lib-node-url-class.ts) | See [node:url](#nodeurl) |
614
- | `EventTarget` / `Event` / `AbortController` / `AbortSignal` | ✅ | [lib-node-abort.ts](conformance/lib-node-abort.ts) | See [node:events](#nodeevents) |
615
- | `performance` / `setImmediate` / `crypto` | ✅ | [lib-node-perf-hooks.ts](conformance/lib-node-perf-hooks.ts) | See [perf_hooks](#nodeperf_hooks), [timers](#nodetimers), [crypto](#nodecrypto) |
616
- | `TypeError` / `RangeError` / `SyntaxError` & co. | ✅ | [lib-node-assert.ts](conformance/lib-node-assert.ts) | `TnError`s carrying their `name`; `instanceof` checks the name |
617
- | `Infinity` | ✅ | [lib-globals.ts](conformance/lib-globals.ts) | `math.Inf(1)` |
618
- | Global `isNaN` / `isFinite` | ✅ | [lib-globals.ts](conformance/lib-globals.ts) | `math.IsNaN` / `math.IsInf` |
619
- | `encodeURIComponent` / `decodeURIComponent` | ✅ | [lib-uri.ts](conformance/lib-uri.ts) | `TnEncodeURIComponent` / `url.PathUnescape` |
620
- | `structuredClone` | ✅ | [lib-structured-clone.ts](conformance/lib-structured-clone.ts) | Reflection deep copy |
621
- | `fetch` / `Headers` / `Request` / `Response` | ✅ | [lib-node-fetch.ts](conformance/lib-node-fetch.ts) | See [fetch](#fetch) |
622
- | `ReadableStream` / `WritableStream` / `TransformStream` & co., `TextEncoderStream` / `TextDecoderStream`, `CompressionStream` / `DecompressionStream` | ✅ | [lib-node-stream-web.ts](conformance/lib-node-stream-web.ts) | See [stream/web](#nodestreamweb) |
623
- | `Blob` / `File` / `FormData` | ✅ | [lib-node-blob.ts](conformance/lib-node-blob.ts) | See [buffer](#nodebuffer) and [fetch](#fetch) |
624
- | `MessageChannel` / `MessagePort` / `BroadcastChannel` | ✅ | [lib-node-worker-threads.ts](conformance/lib-node-worker-threads.ts) | See [worker_threads](#nodeworker_threads) |
625
- | `__filename` / `__dirname` | ✅ | [lib-node-module-filename.ts](conformance/lib-node-module-filename.ts) | The running executable (a native binary has no script file) |
626
- | `globalThis` | ✅ | [lib-global-this.ts](conformance/lib-global-this.ts) | `globalThis.x` is the global `x`; `(globalThis as any)` is a dynamic object |
627
- | `err.stack` | ✅ | [lib-error-stack.ts](conformance/lib-error-stack.ts) | `Name: message` and an `at fn (file.ts:line)` line per TS frame (no columns), from `runtime.Callers` and the `//line` directives |
628
- | `AggregateError` (`errors`) | ✅ | [lib-error-stack.ts](conformance/lib-error-stack.ts) | |
629
- | `Error.captureStackTrace` / `Error.isError` / `DOMException` / `QuotaExceededError` | ✅ | [lib-domexception.ts](conformance/lib-domexception.ts), [lib-es2025-statics.ts](conformance/lib-es2025-statics.ts) | `captureStackTrace` is accepted without effect; `DOMException` carries its legacy `code` (AbortSignal reasons are DOMExceptions) |
630
- | `Symbol.for` / `Symbol.keyFor` / `description` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | A global registry by key |
631
- | `[Symbol.asyncIterator]()` methods; `Symbol.toPrimitive` / `hasInstance` / `toStringTag` | ✅ | [lib-symbol-protocols.ts](conformance/lib-symbol-protocols.ts) | Class members: `async *[Symbol.asyncIterator]()` for `for await`, `[Symbol.toPrimitive](hint)` for `String(x)` / `+x` / templates, a `[Symbol.toStringTag]` getter, a static `[Symbol.hasInstance]` |
632
- | `WeakRef` / `FinalizationRegistry` | ✅ | [lib-weak-refs.ts](conformance/lib-weak-refs.ts) | Go's `weak` package and `runtime.AddCleanup`; cleanup callbacks run on the event loop. Targets must be objects (pointers) |
633
- | `Reflect` (`ownKeys` / `has` / `get` / `set` / `construct` / …) | ✅ | [lib-es2025-statics.ts](conformance/lib-es2025-statics.ts) | Over the dynamic property access helpers; `construct` builds through the class value |
634
- | `Proxy` | 🚫 | — | Intercepting every property access on static Go structs; a `Proxy` limited to dynamic (`any`) objects would be feasible |
635
- | `Intl` (`NumberFormat`, `DateTimeFormat`, `Collator`, `PluralRules`, `ListFormat`, `RelativeTimeFormat`, `Segmenter`, `DisplayNames`, `Locale`, `getCanonicalLocales`, `supportedValuesOf`), `toLocaleString` | ✅ | [lib-intl-number-format.ts](conformance/lib-intl-number-format.ts), [lib-intl-date-time-format.ts](conformance/lib-intl-date-time-format.ts), [lib-intl-collator.ts](conformance/lib-intl-collator.ts), [lib-intl-plural-list-relative.ts](conformance/lib-intl-plural-list-relative.ts), [lib-intl-segmenter.ts](conformance/lib-intl-segmenter.ts), [lib-intl-display-names-locale.ts](conformance/lib-intl-display-names-locale.ts), [lib-intl-to-locale-string.ts](conformance/lib-intl-to-locale-string.ts) | Output captured from Node's ICU (`npm run gen:intl`) for 32 locales; other regions use their language's data (`resolvedOptions().locale` still names them), unknown languages the default locale's. Plural rules, collation and case mapping on `golang.org/x/text`. Gaps: the gregorian calendar only; date patterns for uncommon field combinations are composed from the nearest ones; zone names in English; `Segmenter` has no dictionaries (each ideograph is a word); a bare `localeCompare` keeps a light root collation |
636
- | `Temporal` (`Instant`, `ZonedDateTime`, `PlainDate`, `PlainTime`, `PlainDateTime`, `PlainYearMonth`, `PlainMonthDay`, `Duration`, `Now`) | ✅ | [lib-temporal-plain.ts](conformance/lib-temporal-plain.ts), [lib-temporal-duration.ts](conformance/lib-temporal-duration.ts), [lib-temporal-zoned.ts](conformance/lib-temporal-zoned.ts) | The ISO 8601 calendar on Go's `time` and embedded tzdata (`time/tzdata`, linked only into programs that use it): parsing, `with`, `add` / `subtract`, `until` / `since`, `round` / `total` with every rounding mode, `relativeTo`, DST disambiguation, `getTimeZoneTransition` and the `toString` options. Non-ISO calendars throw a `RangeError` (they need ICU); `toLocaleString` returns a fixed en-US format (no `Intl` calendar names); `Duration.round` keeps the larger calendar unit when a smaller calendar unit cannot hold a whole number of it (Node adds a spurious day in a few such cases, e.g. `P2W` rounded to days) |
637
- | `navigator` (`hardwareConcurrency`, `language(s)`, `platform`, `userAgent`), `CustomEvent`, `ErrorEvent` | ✅ | [lib-web-globals-node26.ts](conformance/lib-web-globals-node26.ts) | `navigator.language` comes from `LANG` / `LC_ALL` (Node asks ICU); both events are `Event`s with their extra fields |
638
- | `URLPattern` (string / init inputs, named groups, wildcards, custom regexps, `ignoreCase`) | ✅ | [lib-url-pattern.ts](conformance/lib-url-pattern.ts) | Components compile to anchored Go regexps; `exec` fills each component's `groups`; protocol / search / hash canonicalized as Node does |
639
- | `WebSocket` (client) | ✅ | [lib-node-websocket.ts](conformance/lib-node-websocket.ts) | An RFC 6455 client over `net` / `tls` (the server side's upgrade exists): the handshake, subprotocols and custom headers, echoes as `string` / `Blob` / `ArrayBuffer`, pings, `bufferedAmount`, the close handshake (client- and server-initiated, 1005 without a code), and undici's constructor / `send` / `close` errors |
640
- | `EventSource`, `reportError` | 🚫 | — | Not globals in Node 26.13 (`EventSource` is behind `--experimental-eventsource`) |
641
- | `localStorage` / `sessionStorage` / `Storage` (`getItem` / `setItem` / `removeItem` / `clear` / `key` / `length`) | ✅ | [lib-web-globals-node26.ts](conformance/lib-web-globals-node26.ts) | `sessionStorage` lives in memory; `localStorage` persists to the file `TN_LOCALSTORAGE_FILE` names (as JSON, not Node's SQLite file) and is `undefined` without one, as in Node 26 |
642
- | `WebAssembly` (`Module`, `Instance`, `Memory`, `Global`, `compile` / `instantiate` / `validate`, `CompileError` / `LinkError` / `RuntimeError`) | ✅ | [lib-webassembly-basic.ts](conformance/lib-webassembly-basic.ts) | Runs on wazero (pure Go, no cgo); `Table` partial. See [wasi](#nodewasi) |
643
- | `Function` as a value (`const Type = Function`), `x instanceof Function` | ✅ | [syntax-error-subclass-idiom.ts](conformance/syntax-error-subclass-idiom.ts) | An opaque sentinel; `instanceof Function` checks for a function value |
644
-
645
- ### Node builtins (`node:*`)
646
-
647
- Every module can be imported as `node:x` or by its bare name (`fs`), with
648
- named, default or namespace imports; subpaths (`fs/promises`, `path/posix`,
649
- `stream/promises`, …) work too. Signatures follow `@types/node`
650
- ([types/typenative-npm.d.ts](types/typenative-npm.d.ts)). Callbacks, timers, I/O
651
- completions and events run on one event loop, one at a time, as in Node; an
652
- async function runs synchronously until its first `await`.
653
-
654
- | Module | Status | Section |
655
- | -------------------------------------------------------------------------------------- | :----: | ----------------------------------------------- |
656
- | `node:assert` / `node:assert/strict` | ✅ | [assert](#nodeassert) |
657
- | `node:async_hooks` | ✅ | [async_hooks](#nodeasync_hooks) |
658
- | `node:buffer` (+ globals `Buffer`, `Uint8Array`, `atob`, `btoa`, `Blob`, `File`) | ✅ | [buffer](#nodebuffer) |
659
- | `node:child_process` | ✅ | [child_process](#nodechild_process) |
660
- | `node:cluster` | ✅ | [cluster](#nodecluster) |
661
- | `node:console` | ✅ | [console](#nodeconsole) |
662
- | `node:constants` | ✅ | [constants](#nodeconstants--nodesys) |
663
- | `node:crypto` (+ global `crypto`) | ✅ | [crypto](#nodecrypto) |
664
- | `node:dgram` | ✅ | [dgram](#nodedgram) |
665
- | `node:diagnostics_channel` | ✅ | [diagnostics_channel](#nodediagnostics_channel) |
666
- | `node:dns` / `node:dns/promises` | ✅ | [dns](#nodedns) |
667
- | `node:domain` | 🚫 | [domain](#nodedomain) |
668
- | `node:events` (+ `EventTarget`, `AbortController`) | ✅ | [events](#nodeevents) |
669
- | `node:ffi` | ✅ | [ffi](#nodeffi) |
670
- | `node:fs` / `node:fs/promises` | ✅ | [fs](#nodefs) |
671
- | `node:http` / `node:https` | ✅ | [http / https](#nodehttp--nodehttps) |
672
- | `node:http2` | ✅ | [http2](#nodehttp2) |
673
- | `node:inspector` | 🚫 | [inspector](#nodeinspector) |
674
- | `node:module` | ✅ | [module](#nodemodule) |
675
- | `node:net` | ✅ | [net](#nodenet) |
676
- | `node:os` | ✅ | [os](#nodeos) |
677
- | `node:path` / `path/posix` / `path/win32` | ✅ | [path](#nodepath) |
678
- | `node:perf_hooks` (+ global `performance`) | ✅ | [perf_hooks](#nodeperf_hooks) |
679
- | `node:process` (+ global `process`) | ✅ | [process](#nodeprocess) |
680
- | `node:punycode` | ✅ | [punycode](#nodepunycode) |
681
- | `node:querystring` | ✅ | [querystring](#nodequerystring) |
682
- | `node:readline` / `node:readline/promises` | ✅ | [readline](#nodereadline) |
683
- | `node:repl` | 🚫 | [repl](#noderepl) |
684
- | `node:sea` | ✅ | [sea](#nodesea) |
685
- | `node:sqlite` | ✅ | [sqlite](#nodesqlite) |
686
- | `node:stream` / `stream/promises` / `stream/consumers` | ✅ | [stream](#nodestream) |
687
- | `node:stream/web` (+ globals `ReadableStream`, `WritableStream`, `TransformStream`, …) | ✅ | [stream/web](#nodestreamweb) |
688
- | `node:string_decoder` | ✅ | [string_decoder](#nodestring_decoder) |
689
- | `node:sys` | ✅ | [constants / sys](#nodeconstants--nodesys) |
690
- | `node:test` | ✅ | [test](#nodetest) |
691
- | `node:test/reporters` | ✅ | [test/reporters](#nodetestreporters) |
692
- | `node:timers` / `node:timers/promises` | ✅ | [timers](#nodetimers) |
693
- | `node:tls` | ✅ | [tls](#nodetls) |
694
- | `node:trace_events` | 🚫 | [trace_events](#nodetrace_events) |
695
- | `node:tty` | ✅ | [tty](#nodetty) |
696
- | `node:url` (+ globals `URL`, `URLSearchParams`) | ✅ | [url](#nodeurl) |
697
- | `node:util` / `node:util/types` | ✅ | [util](#nodeutil) |
698
- | `node:v8` | ✅ | [v8](#nodev8) |
699
- | `node:vm` | 🚫 | [vm](#nodevm) |
700
- | `node:wasi` | ✅ | [wasi](#nodewasi) |
701
- | `node:worker_threads` (+ globals `MessageChannel`, `MessagePort`, `BroadcastChannel`) | ✅ | [worker_threads](#nodeworker_threads) |
702
- | `node:zlib` | ✅ | [zlib](#nodezlib) |
703
- | Global `fetch` (+ `Headers`, `Request`, `Response`, `FormData`) | ✅ | [fetch](#fetch) |
704
-
705
- #### `node:path`
706
-
707
- | API | Status | Probe | Notes |
708
- | ---------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
709
- | `join` / `dirname` / `basename` / `extname` / `resolve` | ✅ | [lib-node-path.ts](conformance/lib-node-path.ts) | Ports of Node's algorithms (not Go's `filepath`): same results as Node |
710
- | `normalize` / `relative` / `isAbsolute` / `parse` / `format` / `sep` / `delimiter` | ✅ | [lib-node-path-more.ts](conformance/lib-node-path-more.ts) | Trailing separators, `.bashrc`-style extensions, `''` for same paths |
711
- | `path.posix` / `path.win32` / `node:path/posix` / `toNamespacedPath` | ✅ | [lib-node-path-posix-win32.ts](conformance/lib-node-path-posix-win32.ts) | Both flavours on every OS (drive letters, UNC roots); `path` is the platform's |
712
- | `matchesGlob` (`*`, `**`, `?`, `[...]`, `{a,b}`; no leading-dot matches) | ✅ | [lib-node-path-glob.ts](conformance/lib-node-path-glob.ts) | minimatch-style patterns compiled to regular expressions |
713
-
714
- #### `node:buffer`
715
-
716
- | API | Status | Probe | Notes |
717
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----: | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
718
- | `Buffer.from` / `alloc` / `concat` / `byteLength` / `isBuffer` / `compare`; `buf[i]`, `length` | ✅ | [lib-node-buffer.ts](conformance/lib-node-buffer.ts) | Buffers are Go `[]byte`; `subarray` / `slice` share memory; writes wrap modulo 256 |
719
- | `toString` / `equals` / `indexOf` / `includes` / `fill` / `write` / `copy` | ✅ | [lib-node-buffer.ts](conformance/lib-node-buffer.ts) | `` `${buf}` `` decodes UTF-8; `console.log(buf)` prints `<Buffer 68 69>` |
720
- | Encodings (utf8, hex, base64, base64url, latin1, ascii, utf16le); `atob` / `btoa` | ✅ | [lib-node-buffer-encodings.ts](conformance/lib-node-buffer-encodings.ts) | Invalid UTF-8 bytes decode to U+FFFD, as in Node |
721
- | `TextEncoder` / `TextDecoder` (`decode(bytes, { stream: true })`), minimal `Uint8Array` | ✅ | [lib-node-buffer-encodings.ts](conformance/lib-node-buffer-encodings.ts) | `Uint8Array` is `[]byte` too: `length`, indexing, `subarray`, `slice`, `set` |
722
- | `read*` / `write*` (U)Int8/16/32 LE/BE, Float, Double | ✅ | [lib-node-buffer-binary.ts](conformance/lib-node-buffer-binary.ts) | Out-of-range offsets throw `ERR_OUT_OF_RANGE` |
723
- | `Blob` / `File` (`size`, `type`, `name`, `lastModified`, `text()` / `bytes()` / `arrayBuffer()`, `slice`, `stream()`); parts of strings, Buffers and Blobs | ✅ | [lib-node-blob.ts](conformance/lib-node-blob.ts) | Also globals; bytes held in memory |
724
- | `read/writeBigInt64LE/BE`, `read/writeBigUInt64LE/BE`, `swap16/32/64`; `isUtf8` / `isAscii` / `transcode` / `kMaxLength` | ✅ | [lib-node-buffer-bigint.ts](conformance/lib-node-buffer-bigint.ts) | bigints are `*big.Int` |
725
- | Typed arrays (`Int8Array`, `Uint8ClampedArray`, `Int16Array`, `Uint16Array`, `Int32Array`, `Uint32Array`, `Float32Array`, `Float64Array`): indexing, `length` / `byteLength` / `buffer`, `from` / `of`, `fill` / `set` / `subarray` / `slice` / `copyWithin`, `map` / `filter` / `reduce` / `forEach` & co., `sort` / `toSorted`, `join`, `for…of`, spread; `ArrayBuffer` (`slice`, `isView`); `DataView` (all getters / setters incl. BigInt64) | ✅ | [lib-typed-arrays.ts](conformance/lib-typed-arrays.ts) | One Go slice per element type; views on an `ArrayBuffer` share its memory. Writes convert like JS (wrapping, clamping). A view's `.buffer` is the `ArrayBuffer` it views, with its real `byteOffset` (an array that owns its elements gives its own bytes, `byteOffset` 0). Out-of-range reads give `0`, not `undefined`. |
726
- | `BigInt64Array` / `BigUint64Array` | ✅ | [lib-typed-array-float16-bigint.ts](conformance/lib-typed-array-float16-bigint.ts) | Elements read and write as bigints (writes wrap modulo 2^64); views over an `ArrayBuffer` share its memory |
727
- | `Uint8Array.fromBase64` / `u8.toBase64()` | ✅ | [lib-uint8array-base64.ts](conformance/lib-uint8array-base64.ts) | Standard alphabet with padding; no options (`alphabet`, `omitPadding`, `lastChunkHandling`) |
728
- | `Float16Array`, `DataView` `getFloat16` / `setFloat16`, `ArrayBuffer` `transfer` / `transferToFixedLength`, `Uint8Array` `toHex` / `fromHex` | ✅ | [lib-typed-array-float16-bigint.ts](conformance/lib-typed-array-float16-bigint.ts), [lib-uint8array-hex-base64.ts](conformance/lib-uint8array-hex-base64.ts) | `Float16Array` stores binary16 bits; `transfer` copies the bytes and detaches the source |
729
- | Resizable `ArrayBuffer` (`new ArrayBuffer(n, { maxByteLength })`, `resize`, `resizable`, `maxByteLength`), `detached`, growable `SharedArrayBuffer` (`grow`, `growable`) | ✅ | [lib-arraybuffer-resizable.ts](conformance/lib-arraybuffer-resizable.ts) | The buffer stays a Go `[]byte`; its length and detached state live beside it, keyed by its address. Typed arrays and DataViews track it (length-tracking views follow `resize`, fixed-length ones go out of bounds and throw `TypeError` from their methods), but a `Uint8Array` is a plain `[]byte` and keeps the length it was made with. `transfer` copies, then detaches the source. Growing past the first allocation moves the bytes. `structuredClone` / `postMessage` transfer lists don't detach, and `WebAssembly.Memory#grow` doesn't detach the old `buffer` |
730
- | `Uint8Array` `setFromBase64` / `setFromHex`; `toBase64` / `fromBase64` options (`alphabet`, `omitPadding`, `lastChunkHandling`) | ✅ | [lib-uint8array-hex-base64.ts](conformance/lib-uint8array-hex-base64.ts) | Strict decoding as the spec has it (a `SyntaxError` on bad input; `{ read, written }`) |
731
- | `Buffer.stringLength(input, encoding)`, `buffer.isLatin1`, `blob.textStream()`, `end` argument of `buf.indexOf` / `lastIndexOf` / `includes`, `alignment` argument of `Buffer.allocUnsafe(Slow)`, `Buffer.poolSize` | ✅ | [lib-buffer-node26.ts](conformance/lib-buffer-node26.ts) | `lastIndexOf` takes its `byteOffset` too; `alignment` is accepted (Go allocations are already aligned) |
732
- | `JSON.stringify(buffer)`, `buf.toJSON()` | ✅ | [lib-buffer-json.ts](conformance/lib-buffer-json.ts) | `{"type":"Buffer","data":[…]}`, keys in that order |
733
-
734
- #### `node:fs`
735
-
736
- | API | Status | Probe | Notes |
737
- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
738
- | `readFileSync` / `writeFileSync` / `appendFileSync` / `existsSync` / `rmSync` | ✅ | [lib-node-fs.ts](conformance/lib-node-fs.ts) | `readFileSync` returns a Buffer without an encoding, a string with one; `flag` option |
739
- | `statSync` / `lstatSync` (`Stats`) / `renameSync` / `copyFileSync` / `truncateSync` / `realpathSync` / `accessSync` / `unlinkSync` | ✅ | [lib-node-fs-stat.ts](conformance/lib-node-fs-stat.ts) | `throwIfNoEntry: false`; Go exposes only the modification time portably, so `atime` / `ctime` / `birthtime` report it too |
740
- | `mkdirSync` / `mkdtempSync` / `readdirSync` (`withFileTypes`, `recursive`) / `rmdirSync` / `cpSync` | ✅ | [lib-node-fs-dirs.ts](conformance/lib-node-fs-dirs.ts) | `Dirent` with `isFile()` / `isDirectory()` / `parentPath` |
741
- | Node system errors (`err.code` / `syscall` / `path` / `errno`) | ✅ | [lib-node-fs-errors.ts](conformance/lib-node-fs-errors.ts) | `ENOENT: no such file or directory, open 'x'`; `EEXIST`, `ENOTEMPTY`, `ERR_FS_EISDIR`, `COPYFILE_EXCL` |
742
- | File descriptors: `openSync` / `readSync` / `writeSync` / `fstatSync` / `closeSync` | ✅ | [lib-node-fs-fd.ts](conformance/lib-node-fs-fd.ts) | Flags `r`, `w`, `a`, `+`, `x`; positional reads and writes |
743
- | Callback API (`readFile(path, enc, (err, data) => …)` & co.) | ✅ | [lib-node-fs-callbacks.ts](conformance/lib-node-fs-callbacks.ts) | Work runs on a goroutine; callbacks run on the event loop |
744
- | `fs/promises` / `fs.promises` (incl. `FileHandle` from `open`) | ✅ | [lib-node-fs-promises.ts](conformance/lib-node-fs-promises.ts) | Rejections carry the error code |
745
- | `createReadStream` / `createWriteStream` | ✅ | [lib-node-fs-streams.ts](conformance/lib-node-fs-streams.ts) | `encoding`, `start` / `end`, `highWaterMark`, `flags` |
746
- | `chmodSync` / `utimesSync` / `symlinkSync` / `readlinkSync` / `linkSync` | ✅ | [lib-node-fs-permissions.ts](conformance/lib-node-fs-permissions.ts), [lib-node-fs-symlinks.ts](conformance/lib-node-fs-symlinks.ts) | Symlinks need a privilege on Windows, so their probe skips `win32`; `chmod` there only maps the write bit |
747
- | `watch` (`recursive`, `persistent`, `signal`, `ref` / `unref`, `'change'` / `'error'` / `'close'`) / `watchFile` / `unwatchFile`; `fs/promises` `watch` | ✅ | [lib-node-fs-watch.ts](conformance/lib-node-fs-watch.ts) | `watch` uses the OS's notifications through the vendored `fsnotify` (only linked into programs that call it); recursive watches add subdirectories as they appear. `watchFile` polls `stat()` |
748
- | Removed in Node 25: `fs.F_OK` / `R_OK` / `W_OK` / `X_OK` (use `fs.constants`), the `recursive` option of `rmdir` / `rmdirSync` / `fs/promises` `rmdir` | ✅ | [lib-node-fs-node26.ts](conformance/lib-node-fs-node26.ts) | Gone from the types (a type error, as Node fails at run time); `fs.constants.F_OK` & co. stay |
749
- | `openAsBlobSync` / `openAsBlob`, `statfs` / `statfsSync` (with `frsize`), the `buffer` option of `readFile`, `signal` on `stat` / `lstat` / `fstat`, callback `fstat` | ✅ | [lib-node-fs-node26.ts](conformance/lib-node-fs-node26.ts) | `statfs` uses `statfs(2)` on Unix and `GetDiskFreeSpace` on Windows (`files` / `ffree` / `type` are 0 there) |
750
- | `Temporal.Instant` fields on `Stats` (`atimeInstant` / `mtimeInstant` / `ctimeInstant` / `birthtimeInstant`) | ✅ | [lib-node-fs-node26.ts](conformance/lib-node-fs-node26.ts) | Built from the existing `time.Time` fields; reading one pulls in the Temporal helper (programs that never read them stay without tzdata) |
751
- | The `windowsHandle` stream option of `createReadStream` / `createWriteStream` | ✅ | [lib-node-fs-windows-handle.ts](conformance/lib-node-fs-windows-handle.ts) | A Windows HANDLE (bigint) the stream reads or writes through, converted into a file at construction as Node's `_open_osfhandle` does. A real HANDLE cannot be obtained from pure JS, so the probe exercises the errors, which are Node's: a non-bigint is a `TypeError`, an unusable handle `EBADF`, both thrown before the path is opened |
752
- | `FileHandle` `pull` / `pullSync` / `writer` | ❌ | — | Not in Node 26.13 yet |
753
- | `glob` / `globSync` / `fs/promises` `glob` (`cwd`, `exclude`, `withFileTypes`, `followSymlinks`, `maxDepth`) | ✅ | [lib-node-fs-node26.ts](conformance/lib-node-fs-node26.ts) | A directory walk matched with `path.matchesGlob`'s patterns; `fs/promises` `glob` is an async iterable |
754
-
755
- #### `node:os`
756
-
757
- | API | Status | Probe | Notes |
758
- | ---------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
759
- | `platform` / `arch` / `type` / `machine` / `EOL` / `devNull` / `endianness` | ✅ | [lib-node-os.ts](conformance/lib-node-os.ts) | Node's names (`win32`, `x64`, `Windows_NT`, `x86_64`) |
760
- | `hostname` / `homedir` / `tmpdir` / `userInfo` / `cpus` / `availableParallelism` / `networkInterfaces` / `constants.signals` | ✅ | [lib-node-os.ts](conformance/lib-node-os.ts) | `cpus()` has one entry per logical CPU (model / speed / times are zero) |
761
- | `totalmem` / `freemem` / `uptime` / `loadavg` / `release` / `version` | ✅ | [lib-node-os-mem.ts](conformance/lib-node-os-mem.ts) | `/proc` on Linux, `sysctl` on macOS / BSD, `GlobalMemoryStatusEx` / `GetTickCount64` on Windows (`loadavg` is zeros there, as in Node) |
762
-
763
- #### `node:process`
764
-
765
- | API | Status | Probe | Notes |
766
- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
767
- | `argv` / `argv0` / `execPath` / `execArgv` / `pid` / `ppid` / `arch` / `version` / `versions` | ✅ | [lib-node-process.ts](conformance/lib-node-process.ts) | `argv` has Node's shape: `[execPath, script, ...args]`; `version` is `v24.0.0`; `versions.go` is Go's |
768
- | `hrtime` / `hrtime.bigint` / `uptime` / `memoryUsage` / `chdir` / `cwd` / `stdout.write` / `nextTick` / `exitCode` | ✅ | [lib-node-process.ts](conformance/lib-node-process.ts) | `exitCode` is applied when the event loop drains |
769
- | `process.env` reads, writes, `delete`, `in`, `Object.keys(process.env)`; `import { env } from 'node:process'` | ✅ | [lib-node-process-env.ts](conformance/lib-node-process-env.ts) | `os.Setenv` / `os.Unsetenv`; missing variables read as `""` |
770
- | `process.on('exit' \| 'SIGINT' \| 'SIGTERM' \| 'SIGHUP')` / `once` / `off` / `emit` | ✅ | [lib-node-process-events.ts](conformance/lib-node-process-events.ts) | `'exit'` runs after the event loop with the exit code; signals arrive on the loop |
771
- | `process.stdin` / `stdout` / `stderr` as streams | ✅ | [lib-node-child-process-async.ts](conformance/lib-node-child-process-async.ts) | `stdin` keeps the process alive only while flowing |
772
- | `stdout.write(data, callback)` / `stderr.write(data, callback)` | ✅ | [lib-process-write-callback.ts](conformance/lib-process-write-callback.ts) | The callback runs after the current code once the data is written; output is flushed before exit |
773
- | `kill` / `emitWarning` / `getuid` / `getgid` | ✅ | [lib-node-process-signals.ts](conformance/lib-node-process-signals.ts) | `getuid` / `getgid` are Go's `os` values (`-1` on Windows, where Node omits them) |
774
- | `on('uncaughtException')` / `'uncaughtExceptionMonitor'` / `'unhandledRejection'` / `'beforeExit'` (per drain, can schedule more work); `cpuUsage` / `resourceUsage` / `availableMemory` / `loadEnvFile` | ✅ | [lib-node-process-uncaught.ts](conformance/lib-node-process-uncaught.ts), [lib-node-os-mem.ts](conformance/lib-node-os-mem.ts) | Throws in the top-level code, loop callbacks and detached async calls reach the handlers; CPU times from `/proc` (Linux) or Go's runtime metrics |
775
- | `stdout.columns` / `rows` / `getWindowSize()` (and `stderr`), `stdin.setRawMode` / `isRaw`, `umask` | ✅ | [lib-node-process-tty.ts](conformance/lib-node-process-tty.ts) | A per-OS helper: `TIOCGWINSZ` and termios ioctls (Linux, macOS, FreeBSD), the console API (Windows). `columns` / `rows` are `0`, not `undefined`, when not a terminal (`columns \|\| 80` still works); raw mode is libuv's and is undone at exit; `setRawMode` throws when stdin isn't a terminal. No raw mode on Linux PowerPC / MIPS, no `umask` on Windows (`0`, as in Node); no `'resize'` event |
776
- | `emitWarning(warning, type)` | ✅ | [lib-process-emit-warning.ts](conformance/lib-process-emit-warning.ts) | `(node:PID) <type>: <message>` on stderr, and Node's `--trace-warnings` hint after the first one |
777
- | `process.version` / `versions.node` reporting Node 26 | ✅ | [lib-node-process-node26.ts](conformance/lib-node-process-node26.ts) | `v26.0.0` |
778
- | `process.ref(x)` / `process.unref(x)`, `set` / `add` / `hasUncaughtExceptionCaptureCallback`, `execve` | ✅ | [lib-node-process-node26.ts](conformance/lib-node-process-node26.ts) | `execve` is `execve(2)` on Unix and throws `ERR_FEATURE_UNAVAILABLE_ON_PLATFORM` on Windows, as in Node |
779
- | `process.permission` (`has`, `drop`) under `--permission` | ✅ | [lib-node-process-permission.ts](conformance/lib-node-process-permission.ts) | `undefined` without the flag, as in Node. A compiled program has no node flags, so the model reads `NODE_OPTIONS` (Node's quoting rules): `--permission`, `--allow-fs-read[=path]`, `--allow-fs-write[=path]`, `--allow-child-process`, `--allow-worker`, `--allow-net`, `--allow-addons`, `--allow-wasi`. Paths are resolved and matched at directory boundaries (a trailing `*` matches a prefix); `drop(scope, path)` removes the grants at or under `path`. `ERR_ACCESS_DENIED` (with `permission` / `resource`) from the sync, callback and promise fs calls, `process.chdir`, child processes, workers, `net` `listen` (throws) / `connect` and dgram `bind` (`'error'`), as in Node. `fs.watch` and `createReadStream` / `createWriteStream` are not gated yet |
780
-
781
- #### `node:console`
782
-
783
- | API | Status | Probe | Notes |
784
- | ----------------------------------------------------------------- | :----: | ------------------------------------------------------------------ | --------------------------------------------------- |
785
- | Module re-export (`import { log } from 'node:console'`) | ✅ | [lib-node-console-class.ts](conformance/lib-node-console-class.ts) | Same as the global `console` |
786
- | `new Console(stdout, stderr)` / `new Console({ stdout, stderr })` | ✅ | [lib-node-console-class.ts](conformance/lib-node-console-class.ts) | `log` / `info` / `debug` / `error` / `warn` / `dir` |
787
-
788
- #### `node:util`
789
-
790
- | API | Status | Probe | Notes |
791
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
792
- | `format` / `formatWithOptions` (`%s %d %i %f %j %o %O %c %%`) | ✅ | [lib-node-util-format.ts](conformance/lib-node-util-format.ts) | Extra arguments appended; also used by `console.log` |
793
- | `inspect` (`depth`, `breakLength`, `compact`) | ✅ | [lib-node-util-inspect.ts](conformance/lib-node-util-inspect.ts) | Node's layout rules: single line up to 80 columns, number arrays grouped in columns, `Map(1) {…}`, `ClassName {…}`, `[Circular *1]` |
794
- | `isDeepStrictEqual` / `types.*` (`node:util/types`) / `deprecate` / `stripVTControlCharacters` / `styleText` | ✅ | [lib-node-util-misc.ts](conformance/lib-node-util-misc.ts) | `styleText` colours only TTYs unless `validateStream: false` |
795
- | `promisify` / `callbackify` | ✅ | [lib-node-util-promisify.ts](conformance/lib-node-util-promisify.ts) | Node functions map to their promise versions at compile time (`fs.readFile`, `setTimeout`, `exec`); other functions are wrapped |
796
- | `parseArgs` (short / long / grouped flags, `multiple`, `default`, `strict`, `allowPositionals`, `allowNegative`, `tokens`, Node's errors), `getSystemErrorName` / `getSystemErrorMessage` / `getSystemErrorMap`, `MIMEType` / `MIMEParams`, `parseEnv` (+ `process.loadEnvFile`), `aborted`, `debuglog` (`NODE_DEBUG`), `toUSVString` | ✅ | [lib-node-util-parse-args.ts](conformance/lib-node-util-parse-args.ts) | |
797
- | `inspect.custom` methods, `getCallSites` | ✅ | [lib-node-util-node26.ts](conformance/lib-node-util-node26.ts) | A `[util.inspect.custom]()` class method is what `inspect` / `console.log` print; call sites are the TS frames (columns are not recorded: 1) |
798
- | `inherits` (legacy) | 🚫 | — | Rewrites prototypes; classes are static Go structs |
799
- | Node's errno numbers per OS (`err.errno`, `getSystemErrorMap`) | ✅ | [lib-node-errno.ts](conformance/lib-node-errno.ts) | libuv's table, generated into `src/node/errno_tables.ts`: the OS's errno on Unix (`ECONNREFUSED` is `-111` on Linux, `-61` on macOS) and libuv's fixed numbers on Windows (`ENOENT` is `-4058`). Messages are libuv's; the map matches Node's on Linux entry for entry |
800
- | `parseArgs` result typed from the `options` config | ✅ | [lib-util-parse-args-typed.ts](conformance/lib-util-parse-args-typed.ts) | `values.json` is a `boolean`, `values.indent` a `string` |
801
- | `markPromiseAsHandled`, `isPartialDeepStrictEqual`, `MIMEType.parse` (returns `null` instead of throwing), hex colours in `styleText` (`'#ff8800'`) | ✅ | [lib-node-util-node26.ts](conformance/lib-node-util-node26.ts) | `#rrggbb` / `#rgb` are 24-bit foreground colours |
802
- | `debounce` / `throttle` | ✅ | [lib-debounce-throttle.ts](conformance/lib-debounce-throttle.ts) | A callable function with `cancel` / `flush` / `ref` / `unref` (throttle: `hasImmediateCapacity`); debounce trails at the end of the wait, throttle admits `limit` calls per interval and queues the rest |
803
-
804
- #### `node:assert`
805
-
806
- | API | Status | Probe | Notes |
807
- | ------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
808
- | `assert` / `ok` / `equal` / `strictEqual` (+ `not*`) / `match` / `throws` / `doesNotThrow` / `fail` / `ifError`; `node:assert/strict` | ✅ | [lib-node-assert.ts](conformance/lib-node-assert.ts) | Failures throw an `AssertionError` (`code: 'ERR_ASSERTION'`, `actual`, `expected`, `operator`); `throws` validates with a RegExp, class or object |
809
- | `deepEqual` / `deepStrictEqual` (+ `not*`) / `rejects` / `doesNotReject` | ✅ | [lib-node-assert-deep.ts](conformance/lib-node-assert-deep.ts) | Key order is ignored for objects, Maps and Sets; failure messages are simplified (no diff). Invalid `Date`s compare equal, as in **Node 25** |
810
- | `printf`-style messages (`assert.ok(v, 'got %s', x)`) and message functions on every assertion; `partialDeepStrictEqual` | ✅ | [lib-node-assert-node26.ts](conformance/lib-node-assert-node26.ts) | As Node 26 has them: `fail` / `throws` / `rejects` keep the message as is; `strictEqual` follows a custom message with the comparison |
811
-
812
- #### `node:url`
813
-
814
- | API | Status | Probe | Notes |
815
- | ----------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
816
- | `fileURLToPath` / `pathToFileURL` | ✅ | [lib-node-url.ts](conformance/lib-node-url.ts) | `pathToFileURL` returns a `URL`; Windows drive letters |
817
- | `URL` (WHATWG): parsing, relative resolution, getters / setters, `canParse`, `parse`; `domainToASCII` / `domainToUnicode`; `format` | ✅ | [lib-node-url-class.ts](conformance/lib-node-url-class.ts) | Special schemes, dot segments, default ports, percent-encode sets, IDN hosts (punycode); invalid input throws `ERR_INVALID_URL` |
818
- | `URLSearchParams` (and `url.searchParams`, kept in sync) | ✅ | [lib-node-url-search-params.ts](conformance/lib-node-url-search-params.ts) | `for...of`, `forEach`, `sort`, construction from strings / objects / pairs |
819
- | Legacy `url.parse` / `url.resolve` | ✅ | [lib-node-url-legacy.ts](conformance/lib-node-url-legacy.ts) | A `Url` whose missing parts are `null`; `resolve` resolves like a browser link |
820
-
821
- #### `node:querystring`
822
-
823
- | API | Status | Probe | Notes |
824
- | ------------------------------------------------------------------- | :----: | -------------------------------------------------------------- | ---------------------------------------------- |
825
- | `parse` / `stringify` / `escape` / `unescape` / `decode` / `encode` | ✅ | [lib-node-querystring.ts](conformance/lib-node-querystring.ts) | Repeated keys become arrays; custom separators |
826
-
827
- #### `node:punycode`
828
-
829
- | API | Status | Probe | Notes |
830
- | --------------------------------------------- | :----: | -------------------------------------------------------- | ------------------------------ |
831
- | `encode` / `decode` / `toASCII` / `toUnicode` | ✅ | [lib-node-punycode.ts](conformance/lib-node-punycode.ts) | RFC 3492 (deprecated upstream) |
832
-
833
- #### `node:string_decoder`
834
-
835
- | API | Status | Probe | Notes |
836
- | --------------------------------- | :----: | -------------------------------------------------------------------- | -------------------------------------------------------------- |
837
- | `StringDecoder` (`write` / `end`) | ✅ | [lib-node-string-decoder.ts](conformance/lib-node-string-decoder.ts) | Holds back split UTF-8 / UTF-16LE characters and base64 groups |
838
-
839
- #### `node:crypto`
840
-
841
- | API | Status | Probe | Notes |
842
- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
843
- | `createHash` / `createHmac` / `hash` / `getHashes` (`update` / `digest` / `copy`) | ✅ | [lib-node-crypto-hash.ts](conformance/lib-node-crypto-hash.ts) | md5, sha1, sha224/256/384/512, sha512-224/256, sha3-224/256/384/512 |
844
- | `randomBytes` / `randomUUID` / `randomInt` / `getRandomValues` / `timingSafeEqual`; global `crypto` | ✅ | [lib-node-crypto-random.ts](conformance/lib-node-crypto-random.ts) | `crypto/rand` |
845
- | `pbkdf2Sync` / `hkdfSync` | ✅ | [lib-node-crypto-kdf.ts](conformance/lib-node-crypto-kdf.ts) | `crypto/pbkdf2` / `crypto/hkdf` (Go 1.24+) |
846
- | `createCipheriv` / `createDecipheriv` (aes-128/192/256-cbc/ctr/gcm) | ✅ | [lib-node-crypto-cipher.ts](conformance/lib-node-crypto-cipher.ts) | GCM output arrives from `final()` (authenticated as a whole) |
847
- | `scryptSync` / `scrypt` (`N` / `r` / `p` / `maxmem` and their aliases); callback forms of `pbkdf2`, `hkdf`, `randomBytes`, `randomFill`; `randomFillSync` | ✅ | [lib-node-crypto-scrypt.ts](conformance/lib-node-crypto-scrypt.ts) | scrypt written out over `crypto/pbkdf2` (Salsa20/8, BlockMix, ROMix); callbacks run on the event loop |
848
- | `KeyObject` (`type`, `asymmetricKeyType`, `asymmetricKeyDetails`, `symmetricKeySize`, `export` as PEM / DER / JWK, `equals`, `KeyObject.from`), `createPrivateKey` / `createPublicKey` / `createSecretKey` (PEM, DER, JWK; pkcs1 / pkcs8 / sec1 / spki; certificates) | ✅ | [lib-node-crypto-keys.ts](conformance/lib-node-crypto-keys.ts) | RSA, EC (P-256 / P-384 / P-521), Ed25519, X25519 |
849
- | `generateKeyPair(Sync)` (`rsa`, `ec`, `ed25519`, `x25519`; KeyObjects or `publicKeyEncoding` / `privateKeyEncoding`), `generateKey(Sync)` (`hmac`, `aes`) | ✅ | [lib-node-crypto-keys.ts](conformance/lib-node-crypto-keys.ts) | RSA keys use the public exponent 65537 |
850
- | `sign` / `verify`, `createSign` / `createVerify` (RSA PKCS#1 v1.5 and PSS with `saltLength`, ECDSA in DER or `ieee-p1363`, Ed25519); `publicEncrypt` / `privateDecrypt` (OAEP with `oaepHash` / `oaepLabel`, PKCS#1, none), `privateEncrypt` / `publicDecrypt`; `crypto.constants` | ✅ | [lib-node-crypto-sign.ts](conformance/lib-node-crypto-sign.ts) | |
851
- | `createECDH` (compressed / uncompressed keys), `getCurves`, `diffieHellman` (ec / x25519 KeyObjects), `createDiffieHellman` / `getDiffieHellman` (modp1 – modp18) | ✅ | [lib-node-crypto-sign.ts](conformance/lib-node-crypto-sign.ts) | `createDiffieHellman(bits)` generates a random (not safe) prime |
852
- | `generatePrime(Sync)` (`bigint`, `safe`, `add` / `rem`), `checkPrime(Sync)` | ✅ | [lib-node-crypto-sign.ts](conformance/lib-node-crypto-sign.ts) | `math/big`'s Miller-Rabin |
853
- | `X509Certificate` (`subject`, `issuer`, `subjectAltName`, `validFrom` / `validTo` (+ `Date`s), fingerprints, `serialNumber`, `ca`, `publicKey`, `raw`, `keyUsage`, `checkHost` / `checkIP` / `checkEmail`, `checkIssued`, `verify`, `toString`, `toLegacyObject`) | ✅ | [lib-node-crypto-keys.ts](conformance/lib-node-crypto-keys.ts) | `crypto/x509` |
854
- | `crypto.subtle` / `webcrypto.subtle`: `digest`, `generateKey`, `importKey` / `exportKey` (`raw`, `spki`, `pkcs8`, `jwk`), `sign` / `verify` (HMAC, RSASSA-PKCS1-v1_5, RSA-PSS, ECDSA, Ed25519), `encrypt` / `decrypt` (AES-GCM / CBC / CTR, RSA-OAEP), `deriveBits` / `deriveKey` (PBKDF2, HKDF, ECDH, X25519), `wrapKey` / `unwrapKey` | ✅ | [lib-node-crypto-subtle.ts](conformance/lib-node-crypto-subtle.ts) | Key usages are recorded but not enforced |
855
- | `Hash` / `Hmac` as streams (`write` / `end`, `'readable'`, `pipe` into a hash, `pipeline`, `setEncoding`) | ✅ | [lib-node-crypto-hash-stream.ts](conformance/lib-node-crypto-hash-stream.ts) | A transform that pushes the digest at the end, as in Node; afterwards `hash.digest()` throws and `hmac.digest()` is empty. Only programs that use a hash as a stream carry the stream code |
856
- | AES key wrap: `id-aes128-wrap` … `id-aes256-wrap-pad` (and the `aes128-wrap` aliases) | ✅ | [lib-node-crypto-keywrap.ts](conformance/lib-node-crypto-keywrap.ts) | RFC 3394 and RFC 5649, checked against the RFC vectors; the whole input goes through one `update()`, as with OpenSSL |
857
- | Encrypted private keys (`passphrase` / `cipher`): PKCS#8 PBES2 and legacy `DEK-Info` PEM, encrypted export (PEM / DER); `rsa-pss` / `dsa` / `dh` / `ed448` / `x448` key types, `secp256k1`, `Certificate` (SPKAC: `verifySpkac` / `exportChallenge` / `exportPublicKey`) | ✅ | [lib-node-crypto-keys-more.ts](conformance/lib-node-crypto-keys-more.ts) | PBES2 is PBKDF2 + AES-CBC (plus 3DES for the legacy headers); Ed448 / X448 / secp256k1 on the vendored `cloudflare/circl` and `decred` curve code (pure Go); RSA-PSS keys use their hash for MGF1 too |
858
- | `randomUUIDv7`, `createMac` / `getMacs` / `Mac` (`update` / `final`) for `hmac`, `kmac128` / `kmac256`, `cmac` | ✅ | [lib-node-crypto-mac.ts](conformance/lib-node-crypto-mac.ts) | KMAC over `crypto/sha3` cSHAKE; AES-CMAC per RFC 4493 |
859
- | `createMac` `gmac` / `poly1305` / `siphash` / `blake2bmac` / `blake2smac`, `parsePKCS12`, SIV and GCM-SIV cipher modes | ✅ | [lib-node-crypto-mac-more.ts](conformance/lib-node-crypto-mac-more.ts), [lib-node-crypto-siv.ts](conformance/lib-node-crypto-siv.ts), [lib-node-crypto-pkcs12.ts](conformance/lib-node-crypto-pkcs12.ts) | Poly1305, SipHash, BLAKE2s / BLAKE2b and RFC 5297 S2V written out over the standard library; GCM-SIV's POLYVAL in GHASH's field. `parsePKCS12(bundle, { passphrase })` returns Node 26's `{ privateKey, certificate, additionalCertificates }`, on the vendored `go-pkcs12` |
860
-
861
- #### `node:zlib`
862
-
863
- | API | Status | Probe | Notes |
864
- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
865
- | `gzipSync` / `gunzipSync` / `deflateSync` / `inflateSync` / `deflateRawSync` / `inflateRawSync` / `unzipSync` / `crc32` / `constants` | ✅ | [lib-node-zlib.ts](conformance/lib-node-zlib.ts) | `{ level }`; invalid input throws `Z_DATA_ERROR` |
866
- | `createGzip` / `createGunzip` / `createDeflate` / `createInflate` / `createDeflateRaw` / `createInflateRaw` / `createUnzip` | ✅ | [lib-node-zlib-streams.ts](conformance/lib-node-zlib-streams.ts) | Transforms that (de)compress when the input ends |
867
- | Callback forms `gzip` / `gunzip` / `deflate` / `inflate` / `deflateRaw` / `inflateRaw` / `unzip` (`buf, [options], cb`) and `util.promisify` of them | ✅ | [lib-node-zlib-async.ts](conformance/lib-node-zlib-async.ts) | The codec runs on a goroutine; the callback runs on the event loop |
868
- | Brotli: `brotliCompressSync` / `brotliDecompressSync`, callback and promisified `brotliCompress` / `brotliDecompress`, `createBrotliCompress` / `createBrotliDecompress`, `constants.BROTLI_*` | ✅ | [lib-node-zlib-brotli.ts](conformance/lib-node-zlib-brotli.ts) | The vendored `andybalholm/brotli` (pure Go, only linked into programs that use it); `params` quality / window. Output matches Node's; decoder errors carry Node's codes |
869
- | ZIP archives: `ZipFile` (`open(Sync)`, `get` / `add` / `delete` / `compact`, `stream`), `ZipBuffer`, `ZipEntry`, `createZipArchive(Sync)`, `zipFiles`, `get/setMaxZipContentSize` | ✅ | [lib-node-zlib-zip.ts](conformance/lib-node-zlib-zip.ts) | **Node 26** (26.8). Archives written byte for byte as Node writes them (`lib/internal/zip`: local headers, Zip64 extras for streamed or oversized members, data descriptors); entries take Buffer / TypedArray / ArrayBuffer / DataView, and `method: 'zstd'` |
870
- | Zstd: `zstdCompressSync` / `zstdDecompressSync`, callback and promisified `zstdCompress` / `zstdDecompress`, `createZstdCompress` / `createZstdDecompress`, `constants.ZSTD_*` | ✅ | [lib-node-zlib-zstd.ts](conformance/lib-node-zlib-zstd.ts) | The vendored `klauspost/compress` (pure Go; only linked into programs that use it) — `level` and `params` window / level. Compressed bytes are the encoder's, so sizes are only compared for their order; it decodes libzstd's frames, decoder errors carry libzstd's codes, and bytes after the last frame are ignored |
871
- | Iterable compression: `compressGzipSync()` / `decompressGzipSync()` and the Deflate / Brotli / Zstd variants | ❌ | — | Not in Node 26.13 yet |
872
-
873
- #### `node:timers`
874
-
875
- | API | Status | Probe | Notes |
876
- | ----------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------- | ------------------------------------------------------- |
877
- | `setTimeout` / `setInterval` / `setImmediate` (+ extra arguments) / `clear*`; global `setImmediate` | ✅ | [lib-node-timers.ts](conformance/lib-node-timers.ts) | Callbacks run on the event loop |
878
- | `node:timers/promises` (`setTimeout`, `setImmediate`, `setInterval`, `scheduler`) | ✅ | [lib-node-timers-promises.ts](conformance/lib-node-timers-promises.ts) | `{ signal }` aborts; `setInterval` is an async iterator |
879
- | `Timeout` / `Immediate` handles: `ref` / `unref` / `hasRef` / `refresh` / `close` (also on intervals) | ✅ | [lib-node-timers-ref.ts](conformance/lib-node-timers-ref.ts) | Unref'ed timers don't keep the process alive |
880
-
881
- #### `node:perf_hooks`
882
-
883
- | API | Status | Probe | Notes |
884
- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------ | ------------------------------------------------- |
885
- | `performance.now` / `timeOrigin` / `mark` / `measure` / `getEntries*` / `clearMarks`; global `performance` | ✅ | [lib-node-perf-hooks.ts](conformance/lib-node-perf-hooks.ts) | Monotonic milliseconds since process start |
886
- | `PerformanceObserver` (`entryTypes` / `type` + `buffered`, batched, sorted by `startTime`), `timerify`, `createHistogram`, `monitorEventLoopDelay`, `eventLoopUtilization` | ✅ | [lib-node-perf-observer.ts](conformance/lib-node-perf-observer.ts) | `eventLoopUtilization` is estimated from CPU time |
887
- | Histogram `cdf` / `ccdf` / `countAt` / `skewness` / `kurtosis` / `snapshot`, `recordCorrected`, `add` / `subtract` | ✅ | [lib-node-hooks-events-node26.ts](conformance/lib-node-hooks-events-node26.ts) | Over the recorded values (population moments; excess kurtosis) |
888
- | Histogram `percentileCI` / `meanCI` / `ewma*` / `burnRate`, `welchTest` / `ksTest` / `mannWhitneyTest` / `cohensD` / `cliffsD`, `linearBuckets` / `logBuckets` / `qrde`, `diff`, `export` / `importHistogram`, `createSlidingWindowHistogram` | ❌ | — | **Node 26** (26.8 – 26.11): needs HdrHistogram's bucketed counts (significant figures) under them — a list of raw values does not reproduce them — plus the C library's statistical methods (Student-t / Kolmogorov p-values, the EWMA over recordDelta, burnRate, qrde, diff, the export blob format and the sliding window's chunk timers) |
889
-
890
- #### `node:tty`
891
-
892
- | API | Status | Probe | Notes |
893
- | ------------------------------------ | :----: | ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
894
- | `isatty(fd)` | ✅ | [lib-node-perf-hooks.ts](conformance/lib-node-perf-hooks.ts) | Character-device check on fds 0–2 |
895
- | `ReadStream` / `WriteStream` classes | ✅ | [lib-node-tty-streams.ts](conformance/lib-node-tty-streams.ts) | Over the process's stdio streams; an fd that is not a terminal throws `ERR_TTY_INIT_FAILED`, as in Node |
896
-
897
- #### `node:constants` / `node:sys`
898
-
899
- | API | Status | Probe | Notes |
900
- | -------------------------------------- | :----: | ------------------------------------------------------------ | ------------------------------------------------------------ |
901
- | `node:constants` (`F_OK`, `SIGINT`, …) | ✅ | [lib-node-perf-hooks.ts](conformance/lib-node-perf-hooks.ts) | Deprecated upstream: `fs.constants` + `os.constants.signals` |
902
- | `node:sys` | ✅ | [lib-node-sys.ts](conformance/lib-node-sys.ts) | Deprecated alias of `node:util` |
903
-
904
- #### `node:events`
905
-
906
- | API | Status | Probe | Notes |
907
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
908
- | `EventEmitter`: `on` / `once` / `off` / `prepend*` / `emit` / `removeAllListeners` / `listenerCount` / `eventNames` / max listeners / `newListener`; unhandled `'error'` throws | ✅ | [lib-node-events.ts](conformance/lib-node-events.ts) | Listeners are called with any signature; removal by identity |
909
- | `class X extends EventEmitter` | ✅ | [lib-node-events-extends.ts](conformance/lib-node-events-extends.ts) | The emitter is embedded; `this.emit` and inherited methods work |
910
- | `events.once` (→ promise) / `events.on` (async iterator) | ✅ | [lib-node-events-once.ts](conformance/lib-node-events-once.ts) | `'error'` rejects `once` |
911
- | `EventTarget` / `Event` / `AbortController` / `AbortSignal` (`abort`, `timeout`, `any`, `throwIfAborted`) | ✅ | [lib-node-abort.ts](conformance/lib-node-abort.ts) | Globals (also exported by `node:events`) |
912
- | `errorMonitor`, `captureRejections` (option and global), `getMaxListeners` / `setMaxListeners` (static), `addAbortListener` | ✅ | [lib-node-events-extra.ts](conformance/lib-node-events-extra.ts) | Captures rejections of listeners that return a promise; async arrow listeners run inline (their `await`s don't yield to `emit`) |
913
- | Symbol event names, `EventEmitterAsyncResource` | ✅ | [lib-node-hooks-events-node26.ts](conformance/lib-node-hooks-events-node26.ts) | Each symbol is its own listener key; `eventNames()` lists it by description |
914
- | `Symbol.for('nodejs.rejection')` / `captureRejectionSymbol` handlers | ✅ | [lib-node-events-rejection.ts](conformance/lib-node-events-rejection.ts) | A subclass's own method gets `(err, event, ...args)` instead of an `'error'` event. As with `captureRejections`, async arrow listeners run inline (a throw before their first `await` is not a rejection) |
915
-
916
- #### `node:stream`
917
-
918
- | API | Status | Probe | Notes |
919
- | ------------------------------------------------------------------------------------------------------------------------ | :----: | ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
920
- | `Readable` (`push`, `read`, `pause` / `resume`, `setEncoding`, `destroy`), `Readable.from`, `for await` | ✅ | [lib-node-stream-readable.ts](conformance/lib-node-stream-readable.ts) | Arrays, strings, Buffers and async generators as sources |
921
- | `'readable'` events (paused mode), `read()` / `read(size)` | ✅ | [lib-node-stream-readable-event.ts](conformance/lib-node-stream-readable-event.ts) | A last `'readable'` (with `read()` giving `null`) comes before `'end'`; `read()` returns everything buffered, `read(n)` waits for `n` bytes unless the stream ended, and what it returns is also a `'data'` event. Chunk boundaries can differ from Node's read-ahead |
922
- | `Writable` (`write` / `end` / callbacks, `final`, `'finish'`, write after end) | ✅ | [lib-node-stream-writable.ts](conformance/lib-node-stream-writable.ts) | Strings become Buffers unless `decodeStrings: false` or `objectMode` |
923
- | `Transform` / `PassThrough` / `Duplex`, `pipe` chains, subclasses overriding `_transform` & co. | ✅ | [lib-node-stream-transform.ts](conformance/lib-node-stream-transform.ts) | Option methods (`transform`, `flush`, `write`, `final`, `read`) and `_`-overrides both work; `this` inside option methods is not the stream (use the callback) |
924
- | `pipeline` / `finished` / `stream/promises` / `stream/consumers` (`text`, `json`, `buffer`) | ✅ | [lib-node-stream-pipeline.ts](conformance/lib-node-stream-pipeline.ts) | Errors destroy the pipeline and reach the callback / rejection |
925
- | `Readable.toWeb` / `fromWeb`, `Writable.toWeb` / `fromWeb`, `Duplex.toWeb` / `fromWeb`, `compose` (Node and web streams) | ✅ | [lib-node-stream-web-bridge.ts](conformance/lib-node-stream-web-bridge.ts) | `toWeb` pauses the Node stream while the web queue is full |
926
- | Backpressure: `highWaterMark` (+ `readable` / `writable` variants, `get/setDefaultHighWaterMark`), `write()` / `push()` → `false`, `'drain'`, `writableNeedDrain`, readable pausing in `pipe` / `pipeline` | ✅ | [lib-node-stream-backpressure.ts](conformance/lib-node-stream-backpressure.ts) | Lengths count bytes (characters once decoded) or objects; `_read` runs again while the buffer is below the mark; a transform's write completes once its output is read |
927
- | `compose` with async generator functions, source generators and async sink functions | ✅ | [lib-node-stream-compose.ts](conformance/lib-node-stream-compose.ts) | Writes into a generator stage don't wait for it to pull them; a throw inside an async generator ends the process (generators run on their own goroutine), not the stream |
928
- | `duplexPair`, `Readable.toWeb` `type` / `Duplex.toWeb` `readableType` (`'bytes'`), `readable[Symbol.for('Stream.toAsyncStreamable')]()` | ✅ | [lib-node-stream-duplex-pair.ts](conformance/lib-node-stream-duplex-pair.ts), [lib-node-stream-web-byob.ts](conformance/lib-node-stream-web-byob.ts) | As in Node 26.13: a write completes once the other side reads it, `destroy()` ends the other side's readable and `destroy(err)` destroys it. `toAsyncStreamable` yields batches of `Uint8Array`s (Node needs `--experimental-stream-iter`) |
929
-
930
- #### `node:stream/web`
931
-
932
- | API | Status | Probe | Notes |
933
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
934
- | `ReadableStream` (underlying source `start` / `pull` / `cancel`, sync or async), `getReader()` → `read` / `releaseLock` / `cancel` / `closed`, `locked`, `cancel`, `tee`, `for await` / `values()`, `ReadableStream.from` | ✅ | [lib-node-stream-web.ts](conformance/lib-node-stream-web.ts) | Promise reactions run as microtasks on the event loop; an error ends `for await` with a throw |
935
- | `WritableStream` (sink `start` / `write` / `close` / `abort`), `getWriter()` → `write` / `close` / `abort` / `ready` / `closed` / `desiredSize` / `releaseLock`; controller `error` / `signal` | ✅ | [lib-node-stream-web.ts](conformance/lib-node-stream-web.ts) | Writes run one at a time; `ready` follows the queue's backpressure |
936
- | `TransformStream` (`transform` / `flush` / `start`, controller `enqueue` / `error` / `terminate`), `pipeThrough` / `pipeTo` (`preventClose` / `preventAbort` / `preventCancel` / `signal`) | ✅ | [lib-node-stream-web.ts](conformance/lib-node-stream-web.ts) | A transform waits until its readable side wants more |
937
- | `CountQueuingStrategy` / `ByteLengthQueuingStrategy`, `{ highWaterMark, size }` strategies | ✅ | [lib-node-stream-web.ts](conformance/lib-node-stream-web.ts) | |
938
- | `TextEncoderStream` / `TextDecoderStream` (characters split across chunks), `CompressionStream` / `DecompressionStream` (`gzip`, `deflate`, `deflate-raw`) | ✅ | [lib-node-stream-web-bridge.ts](conformance/lib-node-stream-web-bridge.ts) | Decompression decodes once the input ends |
939
- | BYOB readers (`getReader({ mode: 'byob' })`, `ReadableStreamBYOBReader`, `read(view, { min })`), byte-stream controllers' `byobRequest` (`respond`, `respondWithNewView`), `autoAllocateChunkSize`, transferring streams (`structuredClone(stream, { transfer: [stream] })`) | ✅ | [lib-node-stream-web-byob.ts](conformance/lib-node-stream-web-byob.ts), [lib-node-stream-web-transfer.ts](conformance/lib-node-stream-web-transfer.ts) | Views are `Uint8Array`s / `Buffer`s, filled in place: the caller's view is not detached (JS transfers its buffer). A transferred stream reads / writes the locked original in-process; `MessagePort` transfer lists don't carry streams |
940
-
941
- #### `node:readline`
942
-
943
- | API | Status | Probe | Notes |
944
- | ------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
945
- | `createInterface` (`'line'` / `'close'`, `question(q, cb)`, `prompt`, `close`, `for await`) | ✅ | [lib-node-readline.ts](conformance/lib-node-readline.ts) | Any readable stream as input (`process.stdin` included) |
946
- | `node:readline/promises` (`await rl.question(q)`) | ✅ | [lib-node-readline-promises.ts](conformance/lib-node-readline-promises.ts) | |
947
- | `question(prompt)` (synchronous) | ✅ | [lib-node-readline-question.ts](conformance/lib-node-readline-question.ts) | TypeNative extension (not in Node): used by the self-hosted compiler |
948
- | `cursorTo` / `moveCursor` / `clearLine` / `clearScreenDown` | ✅ | [lib-node-readline-cursor.ts](conformance/lib-node-readline-cursor.ts) | ANSI escape sequences written to the stream; optional callback |
949
- | `emitKeypressEvents(stream)` (`'keypress'` with `(str, key)`) | ✅ | [lib-node-readline-keypress.ts](conformance/lib-node-readline-keypress.ts) | A port of Node's key decoder: names, `ctrl` / `meta` / `shift`, xterm / rxvt / putty sequences, Escape after 500 ms. `str` is `""` (not `undefined`) for escape sequences, and so are `name` / `code` when Node leaves them out |
950
- | `Interface` line editing (`terminal: true`, or stdin and stdout both terminals), `history` / `historySize` / `removeHistoryDuplicates`, `completer`, `line` / `cursor` / `getCursorPos()` | ✅ | [lib-node-readline-editing.ts](conformance/lib-node-readline-editing.ts) | Cursor keys, Home / End, Emacs ctrl / meta keys, history prefix search and `'history'` events, sync or callback completers (a second Tab lists the candidates); the line is redrawn with ANSI sequences, without wrapping across terminal rows |
951
-
952
- #### `node:child_process`
953
-
954
- | API | Status | Probe | Notes |
955
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
956
- | `execSync` / `execFileSync` / `spawnSync` (`encoding`, `input`, `cwd`, `env`, `shell`, `stdio: 'inherit'`) | ✅ | [lib-node-child-process-sync.ts](conformance/lib-node-child-process-sync.ts) | Buffers unless an encoding is given (as in Node); a non-zero exit throws with `status` / `stdout` / `stderr` |
957
- | `exec` / `execFile` (callbacks), `spawn` → `ChildProcess` (stdio streams, `'exit'` / `'close'`, `kill`); `promisify(exec)` | ✅ | [lib-node-child-process-async.ts](conformance/lib-node-child-process-async.ts) | `'close'` follows the end of the stdio streams being read; exit codes on `err.code` |
958
- | `fork(modulePath, args, { env, cwd, silent })` → `send` / `'message'` / `disconnect` / `'disconnect'` / `connected`; in the child `process.send` / `process.on('message')` / `process.connected` / `process.disconnect` | ✅ | [lib-node-child-process-fork.ts](conformance/lib-node-child-process-fork.ts) | The child is this program run again (branch on `process.argv` / `process.send`), linked over loopback TCP; messages are structured clones (a superset of Node's default JSON) |
959
- | `spawn` `detached`, `child.unref()` / `ref()` | ✅ | [lib-node-child-process-detached.ts](conformance/lib-node-child-process-detached.ts) | A new session (`setsid`) on Unix; `DETACHED_PROCESS \| CREATE_NEW_PROCESS_GROUP` on Windows, as libuv does. An unref'ed child's stdio pipes don't keep the parent alive either |
960
- | `fork('./child.ts')` (another file) | ✅ | [lib-node-worker-entry.ts](conformance/lib-node-worker-entry.ts) | As for workers: a second entry point of the binary |
961
- | `stdio` arrays beyond stdout | ✅ | [lib-node-child-process-stdio.ts](conformance/lib-node-child-process-stdio.ts) | Extra `pipe` entries are `ExtraFiles` (fds 3, 4, …; the parent reads `child.stdio[3+n]`); Windows has no `ExtraFiles`, so each entry is a named pipe the child opens as a real file |
962
- | `serialization: 'advanced'` handle passing (`send(msg, socket)`) | ✅ | [lib-node-ipc-handle.ts](conformance/lib-node-ipc-handle.ts) | Both ways: the socket arrives as the second `'message'` argument with the real addresses and talks to the real peer, and the sender's copy goes silent, as in Node. It is not descriptor passing: the sender keeps the connection and relays its bytes over the IPC link, so it must stay alive and every byte goes through it |
963
-
964
- #### `node:cluster`
965
-
966
- | API | Status | Probe | Notes |
967
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
968
- | `isPrimary` / `isWorker` / `isMaster`, `fork(env)`, `workers`, `worker`, `setupPrimary` / `settings`, `disconnect(cb)`, `SCHED_RR` / `schedulingPolicy`; events `'fork'` / `'online'` / `'listening'` / `'message'` / `'disconnect'` / `'exit'` | ✅ | [lib-node-cluster.ts](conformance/lib-node-cluster.ts) | Workers are this program run again with `NODE_UNIQUE_ID` set |
969
- | `Worker` (`id`, `process`, `send`, `'message'`, `disconnect`, `kill`, `isConnected`, `isDead`, `exitedAfterDisconnect`); `process.send` from workers | ✅ | [lib-node-cluster.ts](conformance/lib-node-cluster.ts) | |
970
- | Shared ports: `net` / `http` / `https` / `tls` servers in workers listen on one port (also `listen(0)`), connections round-robin | ✅ | [lib-node-cluster.ts](conformance/lib-node-cluster.ts) | The primary owns the listener and relays each connection to a worker's private loopback listener with the client's address (no handle passing) |
971
- | `SCHED_NONE` (OS-level balancing), `exclusive: true` listeners, dgram sockets in workers | ✅ | [lib-node-cluster-none.ts](conformance/lib-node-cluster-none.ts) | With `schedulingPolicy = SCHED_NONE` (per process, as in Node) each worker binds the port itself with `SO_REUSEPORT` on Unix, where the kernel balances. Windows has no balancing equivalent: `SO_REUSEADDR` lets the workers bind, but connections may all go to one of them (Node shares one listening handle there). `exclusive: true` binds directly; workers' `reuseAddr` dgram sockets share a port the same way |
972
-
973
- #### `node:diagnostics_channel`
974
-
975
- | API | Status | Probe | Notes |
976
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------- |
977
- | `channel` / `publish` / `subscribe` / `unsubscribe` / `hasSubscribers` | ✅ | [lib-node-diagnostics-channel.ts](conformance/lib-node-diagnostics-channel.ts) | Synchronous; shared by name |
978
- | `tracingChannel` (`start` / `end` / `asyncStart` / `asyncEnd` / `error` channels, `subscribe` / `unsubscribe`, `traceSync` / `tracePromise` / `traceCallback`); `channel.bindStore` / `unbindStore` / `runStores` | ✅ | [lib-node-diagnostics-tracing.ts](conformance/lib-node-diagnostics-tracing.ts) | The context gets `result` / `error`; a struct context without those fields is copied into a record |
979
-
980
- #### `node:net`
981
-
982
- | API | Status | Probe | Notes |
983
- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- |
984
- | `createServer` / `Server` (`listen` forms incl. `{ port, host }` and Unix paths, `address()`, `close(cb)`, `getConnections`, `maxConnections`, `ref` / `unref`; `'listening'` / `'connection'` / `'close'` / `'error'`) | ✅ | [lib-node-net.ts](conformance/lib-node-net.ts) | A listening server keeps the process alive; `close()` emits `'close'` once its connections end |
985
- | `connect` / `createConnection` / `Socket` (a duplex stream: `write` / `end` / `'data'` / `'end'`, `setEncoding`, `remoteAddress` / `remotePort` / `localPort`, `setTimeout` + `'timeout'`, `setNoDelay`, `setKeepAlive`, `destroy`, `'close'(hadError)`) | ✅ | [lib-node-net.ts](conformance/lib-node-net.ts) | One goroutine reads the `net.Conn`; `allowHalfOpen: false` ends the socket after `'end'`, as in Node |
986
- | Node's errors (`connect ECONNREFUSED 127.0.0.1:80`, `EADDRINUSE`, `ECONNRESET`; `code` / `errno` / `syscall` / `address` / `port`) | ✅ | [lib-node-net.ts](conformance/lib-node-net.ts) | |
987
- | `isIP` / `isIPv4` / `isIPv6` | ✅ | [lib-node-net.ts](conformance/lib-node-net.ts) | |
988
- | `BlockList` (`addAddress` / `addRange` / `addSubnet` / `check` / `rules` / `isBlockList`) / `SocketAddress` (`parse`, `toJSON`) | ✅ | [lib-node-net-blocklist.ts](conformance/lib-node-net-blocklist.ts) | `net/netip`; IPv4-mapped IPv6 addresses match IPv4 rules, as in Node |
989
- | `net.Stream`, `get/setDefaultAutoSelectFamily(AttemptTimeout)` | ✅ | [lib-node-net-blocklist.ts](conformance/lib-node-net-blocklist.ts) | Go's dialer always races IPv4 / IPv6, so the settings are reported but not used |
990
- | IPC handle passing (`send(msg, socket)`) | ✅ | [lib-node-ipc-handle.ts](conformance/lib-node-ipc-handle.ts) | A relay, not `SCM_RIGHTS` / `WSADuplicateSocket`: the sender keeps the connection and relays its bytes over the IPC link, and the receiver gets a live `net.Socket` to the real peer with its addresses. The sender must stay alive while the socket is in use |
991
-
992
- #### `node:dns`
993
-
994
- | API | Status | Probe | Notes |
995
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----: | ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
996
- | `lookup` (`family`, `all`) and `dns/promises` / `dns.promises` `lookup` | ✅ | [lib-node-dns.ts](conformance/lib-node-dns.ts) | Go's resolver; `getaddrinfo ENOTFOUND host` errors with `hostname` |
997
- | `resolve` (rrtype) / `resolve4` / `resolve6` / `resolveCname` / `resolveMx` / `resolveTxt` / `resolveNs` / `resolveSrv` / `reverse` (callback and promise forms), `getServers` | ✅ | [lib-node-dns-module.ts](conformance/lib-node-dns-module.ts) | Against a loopback DNS server (no network needed); a TXT record's character-strings come back joined, as Go's `LookupTXT` gives them. `getServers` reads `/etc/resolv.conf` |
998
- | `Resolver` class (callback and `dns/promises` forms: `setServers` / `getServers` / `setLocalAddress` / `cancel`, `timeout` option), module `setServers`, `lookupService` | ✅ | [lib-node-dns-resolver.ts](conformance/lib-node-dns-resolver.ts) | Go's pure resolver dialing the configured servers in turn; `ETIMEOUT` / `ECANCELLED`; services from `/etc/services` |
999
- | `resolveAny` / `resolveCaa` / `resolveNaptr` / `resolvePtr` / `resolveSoa` (and `resolve(name, rrtype)` for them), `resolve4` / `resolve6` `{ ttl: true }`, the `tries` option | ✅ | [lib-node-dns-records.ts](conformance/lib-node-dns-records.ts) | Queries built and parsed with `golang.org/x/net/dns/dnsmessage`, copied from GOROOT like `x/text`: UDP with EDNS0, TCP when truncated, each server in turn `tries` times (default 4, 5 s each). Errors are Node's (`queryX ENOTFOUND host`, `ENODATA`, `ESERVFAIL`, `EREFUSED`, `ETIMEOUT`, `ECANCELLED`); `resolveAny` groups records by type in Node's order |
1000
-
1001
- #### `node:http` / `node:https`
1002
-
1003
- | API | Status | Probe | Notes |
1004
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
1005
- | `createServer((req, res) => …)` / `'request'`; `IncomingMessage` (a Readable: `method`, `url`, `headers`, `headersDistinct`, `rawHeaders`, `httpVersion`, `socket.remoteAddress`) | ✅ | [lib-node-http-server.ts](conformance/lib-node-http-server.ts) | Go's `net/http` serves the connections; bodies stream into the request |
1006
- | `ServerResponse` (a Writable: `statusCode`, `setHeader` / `getHeader` / `getHeaders` / `hasHeader` / `removeHeader` / `appendHeader`, `writeHead`, `write`, `end`, `headersSent`, `'finish'`) | ✅ | [lib-node-http-server.ts](conformance/lib-node-http-server.ts) | `end(data)` without earlier writes sends a `Content-Length`; `write()` streams a chunked body |
1007
- | `request` / `get` (URL strings, `URL` objects, options: `hostname` / `port` / `path` / `method` / `headers` / `auth` / `timeout` / `signal` / `socketPath`); `ClientRequest` (`setHeader`, `write`, `end`, `destroy`, `'response'`, `'error'`, `'timeout'`) | ✅ | [lib-node-http-client.ts](conformance/lib-node-http-client.ts) | No redirects are followed and bodies are not decompressed, as in Node; `destroy()` before a response fails with `socket hang up` |
1008
- | `STATUS_CODES` / `METHODS` / `maxHeaderSize` / `Agent` / `globalAgent` | ✅ | [lib-node-http-server.ts](conformance/lib-node-http-server.ts) | `Agent` options are accepted; Go's transport pools connections |
1009
- | `https.createServer({ key, cert })` / `https.request` / `https.get` (`ca`, `rejectUnauthorized`, `servername`, client `key` / `cert`) | ✅ | [lib-node-https.ts](conformance/lib-node-https.ts) | Certificate checks as in [node:tls](#nodetls) |
1010
- | `headers` values | ✅ | [lib-node-http-client.ts](conformance/lib-node-http-client.ts) | Repeated headers are joined with `, ` (`; ` for `cookie`) — including `set-cookie`, which Node keeps as an array: use `headersDistinct['set-cookie']` |
1011
- | Server `'upgrade'` / `'connect'` (`req, socket, head`) and client `'upgrade'` / `'connect'` events | ✅ | [lib-node-http-upgrade.ts](conformance/lib-node-http-upgrade.ts) | The server hijacks the connection; an upgrade nobody listens for is an ordinary request, an unhandled CONNECT closes the connection, as in Node |
1012
- | `res.addTrailers()` | ✅ | [lib-node-http-trailers.ts](conformance/lib-node-http-trailers.ts) | Sent after a chunked body, as in Node (not with a `Content-Length`); clients read them as `res.trailers` |
1013
- | Trailers on client requests, `Agent` socket pooling control (`maxSockets`, `maxTotalSockets`, `maxFreeSockets`, `keepAlive`, `keepAliveMsecs`, `scheduling`) | ✅ | [lib-node-http-agent.ts](conformance/lib-node-http-agent.ts), [lib-node-http-request-trailers.ts](conformance/lib-node-http-request-trailers.ts) | Trailers go after a streamed (chunked) body whether or not a `Trailer` header names them; `end(data)` alone gets a `Content-Length` and sends only declared ones. `maxSockets` is Go's `MaxConnsPerHost` plus a per-origin dial limit, `maxTotalSockets` a process-wide one, `keepAlive` + `maxFreeSockets` the idle pool. `globalAgent` keeps connections alive, as Node 19+ |
1014
- | `statusMessage` on responses we send, `'checkContinue'` / `'checkExpectation'` | ✅ | [lib-node-http-continue.ts](conformance/lib-node-http-continue.ts) | The HTTP/1 writer sends the reason phrase; with a `checkContinue` listener the request body waits for `res.writeContinue()`, otherwise the 100 is automatic |
1015
- | `res.writeInformation(status, headers)` (any 1xx), `req.signal`, `isValidHeaderName` / `isValidHeaderValue`, `websocketMask` / `websocketUnmask` | ✅ | [lib-node-http-node26.ts](conformance/lib-node-http-node26.ts) | `req.signal` aborts when the client goes away before the response ends |
1016
- | The `httpValidation` option (`'strict'` / `'relaxed'` / `'insecure'`, `insecureHTTPParser`) | ✅ | [lib-node-http-validation.ts](conformance/lib-node-http-validation.ts) | **Node 26.3**: strict rejects control bytes in header values (obs-text stays legal), relaxed / insecure accept them on requests and responses; outgoing headers are checked when set |
1017
-
1018
- #### `node:http2`
1019
-
1020
- | API | Status | Probe | Notes |
1021
- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
1022
- | `createServer` (cleartext h2c) / `createSecureServer({ key, cert, allowHTTP1 })`; `'stream'` → `ServerHttp2Stream` (`respond`, `write` / `end`, `respondWithFile`, `close`, a Duplex over the request body) with `:method` / `:path` / `:scheme` / `:authority` headers | ✅ | [lib-node-http2.ts](conformance/lib-node-http2.ts), [lib-node-http2-secure.ts](conformance/lib-node-http2-secure.ts), [lib-node-http2-allow-http1.ts](conformance/lib-node-http2-allow-http1.ts) | Each connection is served by `golang.org/x/net/http2`'s `ServeConn` (net/http's HTTP/2 on Go 1.27); with `allowHTTP1`, a TLS connection that negotiates `http/1.1` goes to the node:http server |
1023
- | Compatibility API: `(req, res)` handlers get `Http2ServerRequest` / `Http2ServerResponse` (`httpVersion` `'2.0'`, pseudo-headers in `req.headers`) | ✅ | [lib-node-http2.ts](conformance/lib-node-http2.ts) | The node:http objects |
1024
- | `connect(authority, { ca, rejectUnauthorized, servername })` → `ClientHttp2Session` (`request`, `close`, `destroy`, `'connect'` / `'error'` / `'close'`, `alpnProtocol`, `encrypted`); `ClientHttp2Stream` (`'response'` with `:status`, body as a Readable, request bodies) | ✅ | [lib-node-http2.ts](conformance/lib-node-http2.ts), [lib-node-http2-secure.ts](conformance/lib-node-http2-secure.ts) | Connection failures error the session and cancel its streams (`ERR_HTTP2_STREAM_CANCEL`); request bodies are sent once the writable side ends |
1025
- | `constants`, `getDefaultSettings` | ✅ | [lib-node-http2.ts](conformance/lib-node-http2.ts) | |
1026
- | `ping`, `settings`, `goaway`, `altsvc`, the server's `'session'` event, `type`, `localSettings` / `remoteSettings` / `pendingSettingsAck`, the `'ping'` / `'localSettings'` / `'remoteSettings'` / `'goaway'` / `'altsvc'` events, `getPackedSettings` / `getUnpackedSettings` | ✅ | [lib-node-http2-frames.ts](conformance/lib-node-http2-frames.ts) | On the vendored `golang.org/x/net/http2`, whose `ServeConn` / `NewClientConn` run each session over a connection that is split into frames: the session's own PING / SETTINGS / GOAWAY / ALTSVC frames go out only between the library's frames, and the peer's reach the session (the ACKs of its own PINGs and SETTINGS are kept from the library). Callbacks follow the peer's ACK; a NO_ERROR GOAWAY closes the receiving session, as in Node. `settings()` never advertises a larger `initialWindowSize` / `maxFrameSize` / `headerTableSize` than Go's HTTP/2 itself does (the peer would send what it refuses) |
1027
- | HTTP/1.1 `Upgrade: h2c` handshake | 🚫 | — | Cleartext HTTP/2 uses prior knowledge (the client preface), as Node does: an HTTP/1.1 Upgrade request is not turned into a session |
1028
- | Server push | 🚫 | — | Deprecated (browsers removed it); Go's server doesn't push |
1029
-
1030
- #### `node:tls`
1031
-
1032
- | API | Status | Probe | Notes |
1033
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----: | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1034
- | `createServer({ key, cert, ca, requestCert, ALPNProtocols, minVersion, maxVersion }, cb)` / `'secureConnection'` | ✅ | [lib-node-tls.ts](conformance/lib-node-tls.ts) | Handshakes run on the accept goroutine |
1035
- | `connect` (`host`, `port`, `ca`, `servername`, `rejectUnauthorized`, client `key` / `cert`) / `'secureConnect'`; `TLSSocket` (`authorized`, `authorizationError`, `encrypted`, `alpnProtocol`, `getPeerCertificate`, `getProtocol`, `getCipher`) | ✅ | [lib-node-tls.ts](conformance/lib-node-tls.ts) | Node's verification codes: `DEPTH_ZERO_SELF_SIGNED_CERT`, `SELF_SIGNED_CERT_IN_CHAIN`, `UNABLE_TO_GET_ISSUER_CERT_LOCALLY`, `CERT_HAS_EXPIRED`, `ERR_TLS_CERT_ALTNAME_INVALID` |
1036
- | `createSecureContext` / `getCiphers` / `DEFAULT_MIN_VERSION` / `DEFAULT_MAX_VERSION` | ✅ | [lib-node-tls-context.ts](conformance/lib-node-tls-context.ts) | Cipher names are Go's |
1037
- | `checkServerIdentity` (function and `connect` option) | ✅ | [lib-node-tls-identity.ts](conformance/lib-node-tls-identity.ts) | Node's rules: one leftmost wildcard label, IP altnames, CN only without DNS altnames |
1038
- | PFX (`pfx`, `{ buf, passphrase }` entries) / passphrase-protected keys, session resumption (`session`, `'newSession'` / `'resumeSession'`, `getSession`, `isSessionReused`), `rootCertificates` | ✅ | [lib-node-tls-pfx.ts](conformance/lib-node-tls-pfx.ts) | PFX on the vendored `go-pkcs12`; session tickets are Go's (`WrapSession` / `UnwrapSession`), with Node's opaque `session` Buffers; `rootCertificates` is Node's 118-certificate Mozilla bundle, linked only into programs that read it |
1039
- | `renegotiate` | 🚫 | — | Deprecated: TLS 1.3 forbids renegotiation, and Go's `crypto/tls` never starts or accepts one on a server |
1040
-
1041
- #### `node:dgram`
1042
-
1043
- | API | Status | Probe | Notes |
1044
- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1045
- | `createSocket('udp4' \| 'udp6' \| { type })`, `bind`, `send` (offset / length forms, callback), `'message'(msg, rinfo)`, `address`, `close`, `connect` / `disconnect` / `remoteAddress`, `ref` / `unref` | ✅ | [lib-node-dgram.ts](conformance/lib-node-dgram.ts) | `send` binds an unbound socket first, as in Node |
1046
- | `addMembership` / `dropMembership`, `setMulticastInterface` / `setMulticastTTL` / `setMulticastLoopback`, `setBroadcast`, `setTTL` | ✅ | [lib-node-dgram-multicast.ts](conformance/lib-node-dgram-multicast.ts) | `setsockopt` on the socket per OS (Linux, macOS, the BSDs, Windows). Options before `bind()` throw `EBADF` and membership binds an unbound socket, as in Node |
1047
- | `addSourceSpecificMembership` / `dropSourceSpecificMembership` | ✅ | [lib-node-dgram-ssm.ts](conformance/lib-node-dgram-ssm.ts) | `IP_ADD_SOURCE_MEMBERSHIP` / `MCAST_JOIN_SOURCE_GROUP`, whose struct layout differs per OS (Linux, macOS, the BSDs, Windows); an unbound socket binds first and errors are Node's (`EINVAL`, `ERR_SOCKET_DGRAM_NOT_RUNNING`), as in Node |
1048
-
1049
- #### `fetch`
1050
-
1051
- | API | Status | Probe | Notes |
1052
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1053
- | `fetch(url \| Request, { method, headers, body, redirect, signal })`; `Response` (`status`, `ok`, `statusText`, `headers`, `url`, `redirected`, `text()` / `json()` / `bytes()` / `arrayBuffer()`, `clone()`, `Response.json` / `error` / `redirect`) | ✅ | [lib-node-fetch.ts](conformance/lib-node-fetch.ts) | Follows redirects (`manual` / `error` too); gzip bodies are decompressed; failures reject with `TypeError('fetch failed')` whose `cause` is the system error; aborts reject with `AbortError` |
1054
- | `Headers` (`get` / `set` / `append` / `has` / `delete` / `forEach` / `entries` / `getSetCookie`, `for...of`) / `Request` | ✅ | [lib-node-fetch.ts](conformance/lib-node-fetch.ts) | Names are lower-cased and iterated in sorted order |
1055
- | Streaming bodies: `response.body` / `request.body` as `ReadableStream`s, `ReadableStream` request bodies (`duplex: 'half'`), `clone()` tees the body | ✅ | [lib-node-fetch-stream.ts](conformance/lib-node-fetch-stream.ts) | Network bodies are read a chunk per pull |
1056
- | `Blob` / `FormData` bodies (multipart encoding), `blob()` / `formData()` (multipart and urlencoded) | ✅ | [lib-node-blob.ts](conformance/lib-node-blob.ts), [lib-node-fetch-stream.ts](conformance/lib-node-fetch-stream.ts) | |
1057
- | The Fetch standard's bad-port list (also on redirects) | ✅ | [lib-node-fetch-bad-port.ts](conformance/lib-node-fetch-bad-port.ts) | `TypeError: fetch failed` with cause `bad port` |
1058
-
1059
- #### `node:async_hooks`
1060
-
1061
- | API | Status | Probe | Notes |
1062
- | ------------------------------------------------------------------------------------------------------------ | :----: | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1063
- | `AsyncLocalStorage` (`run`, `getStore`, `enterWith`, `exit`, `disable`, static `bind` / `snapshot`) | ✅ | [lib-node-async-hooks.ts](conformance/lib-node-async-hooks.ts) | The store follows timers, `setImmediate`, `nextTick`, microtasks, promise callbacks, `await`, async function bodies, fs / dns callbacks; streams, sockets and servers emit in the context they were created / listened in |
1064
- | `AsyncResource` (`runInAsyncScope`, `bind`, `asyncId`, static `bind`) | ✅ | [lib-node-async-hooks.ts](conformance/lib-node-async-hooks.ts) | Captures the context it is created in |
1065
- | `createHook` callbacks (`init` / `before` / `after` / `destroy`), real `executionAsyncId` / `triggerAsyncId` | ✅ | [lib-node-hooks-events-node26.ts](conformance/lib-node-hooks-events-node26.ts) | Ids are tracked once a program uses them: each timer / promise continuation / I/O callback gets one; `init` reports the type as `'Timeout'` |
1066
-
1067
- #### `node:test`
1068
-
1069
- | API | Status | Probe | Notes |
1070
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----: | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1071
- | `test` / `it` / `describe` / `suite` (+ `.skip` / `.todo` / `.only`; `skip` / `todo` / `timeout` options); sync, async and `done`-callback tests | ✅ | [lib-node-test.ts](conformance/lib-node-test.ts) | Tests run one after another once the main module has finished, as in Node |
1072
- | `before` / `after` / `beforeEach` / `afterEach` (file and suite level, `t.before` & co.) | ✅ | [lib-node-test.ts](conformance/lib-node-test.ts) | Node's order: outer `beforeEach` first, inner `afterEach` first |
1073
- | `TestContext`: `t.test` subtests, `t.skip`, `t.todo`, `t.diagnostic`, `t.plan`, `t.name`, `t.fullName`, `t.signal`, `t.mock` | ✅ | [lib-node-test.ts](conformance/lib-node-test.ts) | |
1074
- | Reporting: TAP (Node's default when stdout is not a terminal) / spec (on a terminal); `tests` / `suites` / `pass` / `fail` / `cancelled` / `skipped` / `todo` counters; exit code 1 on failure | ✅ | [lib-node-test-fail.ts](conformance/lib-node-test-fail.ts) | Same layout as Node, including each failure's `location` (`file:line:col`); stack traces are the remaining gap (the `//line` directives make them recoverable through `runtime.Callers`); timeouts count as cancelled |
1075
- | `mock.fn(original?, implementation?)`; `fn.mock.calls` / `callCount()` / `mockImplementation(Once)` / `resetCalls()` / `restore()` | ✅ | [lib-node-test.ts](conformance/lib-node-test.ts) | The mock has the original's Go function type |
1076
- | `t.assert` (`node:assert`'s functions, counted by `t.plan`) and `mock.timers` (`enable({ apis, now })`, `tick`, `runAll`, `setTime`, `reset`; `setTimeout` / `setInterval` / `setImmediate` / `Date`) | ✅ | [lib-node-test-mock-timers.ts](conformance/lib-node-test-mock-timers.ts) | Mocked timers do not keep the process alive; `t.mock` timers reset after each test |
1077
- | `mock.method` / `mock.getter` / `mock.setter` | ✅ | [lib-node-test-mock-members.ts](conformance/lib-node-test-mock-members.ts) | Object-literal methods and getters swap the closure field; class methods route through per-instance override slots (other instances keep theirs, inherited members included); namespace functions (`console.log`, `Math.random`, …) dispatch by name; `t.mock` restores after each test |
1078
- | `NODE_OPTIONS` flags: `--test-name-pattern` / `--test-skip-pattern` (repeatable, `/re/flags`), `--test-only`, `--test-reporter=tap\|spec\|dot\|junit` with `--test-reporter-destination` (a file, `stdout` or `stderr`, one per reporter); Node's notice for `.only` without `--test-only` | ✅ | [lib-node-test-flags.ts](conformance/lib-node-test-flags.ts) | Read from `NODE_OPTIONS`, as Node reads them (arguments after a program never reach Node's runner either). Filtered-out tests are not reported; a matching suite runs all its tests. The TAP / spec / dot outputs match Node's; junit's failure bodies have no stack traces |
1079
- | Snapshots: `t.assert.snapshot` / `t.assert.fileSnapshot`, `--test-update-snapshots`, `snapshot.setDefaultSnapshotSerializers` / `setResolveSnapshotPath` | ✅ | [lib-node-test-snapshots.ts](conformance/lib-node-test-snapshots.ts) | Node's `<test file>.snapshot` format (entries sorted by name, JSON values), redirectable with `setResolveSnapshotPath`; a missing file or entry names the update flag |
1080
- | `run({ files })`: a TestsStream (`test:pass` & co. events, `compose(reporter)`, `pipe`) | ✅ | [lib-node-test-run.ts](conformance/lib-node-test-run.ts) | Files with literal paths compile in as entry points and run as child processes; top-level numbering continues across files, child output becomes `test:stdout` / `test:stderr`, coverage and summaries merge |
1081
- | Coverage: `--experimental-test-coverage`, `--test-coverage-include` / `-exclude`, `-lines` / `-branches` / `-functions` thresholds | ✅ | [lib-node-test-coverage.ts](conformance/lib-node-test-coverage.ts) | Programs that import `node:test` count what runs over V8-style source ranges (functions, blocks, ternary arms, `&&` / `\|\|` / `??` operands, class field initializers); `node:coverage ignore` comments exclude ranges; lcov records and the tap / spec table match Node's output |
1082
- | `t.log`, `getTestContext`, `t.passed` / `t.attempt` / `t.workerId`, tags (`t.tags`), `t.assert.called` / `callCount` / `nthCalledWith` / `lastCalledWith` | ✅ | [lib-node-test-node26.ts](conformance/lib-node-test-node26.ts) | `t.log` reports like `t.diagnostic`; `attempt` is 0 and `workerId` undefined (no retries, no isolated workers) |
1083
- | `--test-randomize` / `--test-random-seed`, the `Randomized test order seed` diagnostic | ✅ | [lib-node-test-randomize.ts](conformance/lib-node-test-randomize.ts) | Each parent's siblings run in a seeded random order — Node's Mulberry32 pick among those still waiting (`floor(rng() * n)`, spliced), one generator per parent; `--test-random-seed` implies randomize, and without one a random seed is generated and reported before the summary (as `node --test` does) |
1084
- | `--test-coverage-include-all` | ✅ | [lib-node-test-coverage-include-all.ts](conformance/lib-node-test-coverage-include-all.ts) | The working directory's `**/*.{cjs,cts,js,mjs,mts,ts}` files that never ran (without node_modules directories) appear in the report with their whole file uncovered (0% lines, 100% branches and functions), grouped and indented like Node's table |
1085
- | the `'test:log'` event | ✅ | [lib-node-test-log.ts](conformance/lib-node-test-log.ts) | t.log emits `test:log` on run()'s TestsStream (the message and the test's name), while the reporters still show the message like t.diagnostic's |
1086
- | `'test:interrupted'` | ❌ | — | Needs a SIGINT delivered to a child mid-run; Windows' console emulation doesn't carry it to a compiled program the way Node's own children get it |
1087
-
1088
- #### `node:worker_threads`
1089
-
1090
- | API | Status | Probe | Notes |
1091
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----: | -------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1092
- | `Worker` (`workerData`, `argv`, `env` / `SHARE_ENV`; `postMessage`, `'online'` / `'message'` / `'error'` / `'exit'`, `terminate()`, `threadId`, `ref` / `unref`); `isMainThread`, `parentPort`, `workerData`, `threadId` | ✅ | [lib-node-worker-threads.ts](conformance/lib-node-worker-threads.ts) | A worker re-runs the current program as a child process (an isolate of its own, as in Node) linked over loopback TCP; branch on `isMainThread` |
1093
- | Messages: structured clone of JSON-like values, Buffers (arriving as `Uint8Array`s), `Map`, `Set`, `Date`, `bigint`, errors | ✅ | [lib-node-worker-threads.ts](conformance/lib-node-worker-threads.ts) | Objects and records keep their key order, and convert to the listener's declared types; functions throw `DataCloneError` |
1094
- | Uncaught exceptions in a worker / `terminate()` | ✅ | [lib-node-worker-errors.ts](conformance/lib-node-worker-errors.ts) | `'error'` with the message, then exit code `1` |
1095
- | `MessageChannel` / `MessagePort` (`postMessage`, `on('message')`, `onmessage`, `start`, `close`, `ref` / `unref`), `receiveMessageOnPort`, `BroadcastChannel`, `get/setEnvironmentData` | ✅ | [lib-node-worker-threads.ts](conformance/lib-node-worker-threads.ts) | Channels and broadcast channels work within one process (ports can't be transferred to workers) |
1096
- | `new Worker('./worker.ts')` (another file) | ✅ | [lib-node-worker-entry.ts](conformance/lib-node-worker-entry.ts) | The file (a literal path, `new URL('./f.ts', import.meta.url)` or `path.join(__dirname, 'f.ts')`, resolved from the source file at compile time) is compiled into the binary as a second entry point; the child runs it instead of the program, picked by `TN_ENTRY`. Its top-level names share one Go package with the program, so they must not clash; files the program imports still run their top-level code in every process |
1097
- | Transferring ports, `resourceLimits`, worker `stdout: true` streams | ✅ | [lib-node-worker-transfer.ts](conformance/lib-node-worker-transfer.ts) | Ports relay over the worker link (a transferred port's messages travel as frames; close propagates); `resourceLimits` are the worker's soft memory limit with a live-heap monitor (`ERR_WORKER_OUT_OF_MEMORY`, exit 1) and `stackSizeMb` caps goroutine stacks; `stdout` / `stderr: true` streams and a parent-side `w.resourceLimits` that is `{}` once the worker has exited |
1098
- | `eval: true`, `SharedArrayBuffer` / `Atomics` | 🚫 | — | `eval` needs a JavaScript engine; workers are processes, so memory is not shared |
1099
-
1100
- #### `node:sqlite`
1101
-
1102
- SQLite comes from [ncruces/go-sqlite3](https://github.com/ncruces/go-sqlite3): SQLite compiled
1103
- to Wasm and translated to Go, so programs need no cgo and still cross-compile. The npm package
1104
- ships the driver in [govendor/](govendor/) (`npm run vendor:go` updates it), so builds need no
1105
- network; it adds about 10 MB to a binary. Rows are records: `row.name`, `row as Row` and
1106
- `rows as Row[]` all work.
1107
-
1108
- | API | Status | Probe | Notes |
1109
- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
1110
- | `new DatabaseSync(path, options)` (`:memory:`, files, `file:` URIs), `open` / `close` / `isOpen` / `isTransaction` / `location()`, `exec` | ✅ | [lib-node-sqlite.ts](conformance/lib-node-sqlite.ts) | `open: false` defers to `open()` |
1111
- | `prepare(sql, options)`; `StatementSync#run` (`{ changes, lastInsertRowid }`) / `get` / `all` / `iterate` (`for…of`, `next()`) | ✅ | [lib-node-sqlite.ts](conformance/lib-node-sqlite.ts) | Rows are objects keyed by column name; `get()` without a row is `undefined` |
1112
- | Parameters: anonymous `?`, named `:x` / `$x` / `@x`, bare names (`{ x }`); values `null`, number (REAL), bigint (INTEGER), string, boolean (1 / 0), `Uint8Array` / Buffer | ✅ | [lib-node-sqlite.ts](conformance/lib-node-sqlite.ts) | Results: INTEGER → number (bigint with `readBigInts`), REAL → number, TEXT → string, BLOB → `Uint8Array`, NULL → `null` |
1113
- | Options `readOnly`, `enableForeignKeyConstraints` (on by default), `enableDoubleQuotedStringLiterals`, `timeout`, `readBigInts`, `returnArrays`, `allowBareNamedParameters`, `allowUnknownNamedParameters`, `defensive`, `limits` | ✅ | [lib-node-sqlite-options.ts](conformance/lib-node-sqlite-options.ts) | `db.limits.x = n` sets a limit; `Infinity` restores the maximum |
1114
- | `columns()`, `sourceSQL`, `expandedSQL`, `setReadBigInts` / `setReturnArrays` / `setAllowBareNamedParameters` / `setAllowUnknownNamedParameters`, `enableDefensive` | ✅ | [lib-node-sqlite-options.ts](conformance/lib-node-sqlite-options.ts) | |
1115
- | `createTagStore()` (`` sql.get`… ${x}` `` / `all` / `run` / `iterate`, `size`, `capacity`, `clear`) | ✅ | [lib-node-sqlite-options.ts](conformance/lib-node-sqlite-options.ts) | One cached statement per template, least recently used out first |
1116
- | `function(name, options, fn)` (`deterministic`, `directOnly`, `varargs`, `useBigIntArguments`), `aggregate(name, { start, step, result, inverse })` (window functions) | ✅ | [lib-node-sqlite-functions.ts](conformance/lib-node-sqlite-functions.ts) | A throw inside the callback is rethrown by the statement |
1117
- | `setAuthorizer(callback)`, `constants` (`SQLITE_OK` / `DENY` / `IGNORE`, action codes, `SQLITE_CHANGESET_*`) | ✅ | [lib-node-sqlite-functions.ts](conformance/lib-node-sqlite-functions.ts) | |
1118
- | Errors: SQLite's message with `code: 'ERR_SQLITE_ERROR'`, `errcode` (extended result code), `errstr`; `ERR_INVALID_STATE` / `ERR_OUT_OF_RANGE` / `ERR_INVALID_ARG_VALUE` | ✅ | [lib-node-sqlite-errors.ts](conformance/lib-node-sqlite-errors.ts) | Same messages as Node 24 |
1119
- | `backup(db, path, { source, rate, progress })` | ✅ | [lib-node-sqlite-errors.ts](conformance/lib-node-sqlite-errors.ts) | Copies `rate` pages per event-loop turn; resolves with the page count |
1120
- | `loadExtension` / `enableLoadExtension` | 🚫 | — | SQLite runs as Wasm inside the program; native extensions can't load |
1121
- | `createSession` / `applyChangeset` | ❌ | — | The bundled SQLite build has no session extension: needs an emulation over the preupdate hook (hard) |
1122
- | `serialize(dbName?)` / `deserialize(buffer, { dbName })` | ✅ | [lib-node-sqlite-serialize.ts](conformance/lib-node-sqlite-serialize.ts) | **Node 26** (26.1) API. The driver has no `sqlite3_serialize` binding, so the image goes through a temporary file and SQLite's backup API |
1123
- | `undefined` as a parameter value | ✅ | [lib-node-sqlite-undefined.ts](conformance/lib-node-sqlite-undefined.ts) | Binds NULL, as **Node 26** (26.10) does; Node 24 threw. `undefined` and `null` are both `nil` |
1124
- | `[Object: null prototype]` rows | 🚫 | — | Rows print as plain objects |
1125
- | `Database` / `Statement` class names | ✅ | [lib-node-sqlite-node26.ts](conformance/lib-node-sqlite-node26.ts) | The same classes as `DatabaseSync` / `StatementSync` |
1126
- | `statement.close()` / `statement[Symbol.dispose]()` / `stat(counter)` / `resetStats()` | ✅ | [lib-node-sqlite-node26.ts](conformance/lib-node-sqlite-node26.ts) | SQLite's statement status counters |
1127
- | `database.createModule(name, options)` (virtual tables) | ❌ | — | **Node 26.11**: needs the driver's virtual-table module API wired to JS callbacks |
1128
- | Finalizing a statement when it is garbage-collected | ✅ | [lib-node-sqlite-finalize.ts](conformance/lib-node-sqlite-finalize.ts) | `runtime.AddCleanup` posts the finalize to the event loop once nothing references the statement; `db.close()` finalizes the rest |
1129
-
1130
- #### `node:inspector`
1131
-
1132
- | API | Status | Probe | Notes |
1133
- | ------------------------------------------------------- | :----: | ----- | ------------------------------------------------------------------------------ |
1134
- | Debugger / profiler sessions (`Session`, `open`, `url`) | 🚫 | — | Speaks the inspector protocol of a JavaScript engine; a native binary has none |
1135
-
1136
- #### `node:repl`
1137
-
1138
- | API | Status | Probe | Notes |
1139
- | ---------------------- | :----: | ----- | ---------------------------------------------------------- |
1140
- | `start` / `REPLServer` | 🚫 | — | Evaluates JavaScript at runtime; needs a JavaScript engine |
1141
-
1142
- #### `node:vm`
1143
-
1144
- | API | Status | Probe | Notes |
1145
- | --------------------------------------------------------------------- | :----: | ----- | ----------------------------------------------------------------------- |
1146
- | `Script` / `runInContext` / `createContext` / `compileFunction` & co. | 🚫 | — | Compiles and runs JavaScript code at runtime; needs a JavaScript engine |
1147
-
1148
- #### `node:v8`
1149
-
1150
- | API | Status | Probe | Notes |
1151
- | ------------------------------------------------------- | :----: | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1152
- | `getHeapStatistics`, `serialize` / `deserialize` | ✅ | [lib-node-module-v8.ts](conformance/lib-node-module-v8.ts) | Heap numbers from `runtime.MemStats` (the limit is `GOMEMLIMIT`, else 4 GiB); `serialize` uses the structured-clone codec workers use, not V8's wire format; objects keep their key order |
1153
- | `getHeapSpaceStatistics`, `getHeapCodeStatistics` | ✅ | [lib-node-process-node26.ts](conformance/lib-node-process-node26.ts) | V8's space names: `old_space` is Go's heap, the rest are empty; code statistics are 0 |
1154
- | Heap snapshots, `setFlagsFromString`, `startupSnapshot` | 🚫 | — | V8 internals; there is no V8 in a native binary |
1155
-
1156
- #### `node:wasi`
1157
-
1158
- `node:wasi` and the `WebAssembly` global run on [wazero](https://github.com/tetratelabs/wazero):
1159
- a pure-Go WebAssembly runtime (an optimizing compiler on amd64 / arm64, an interpreter
1160
- elsewhere), so programs need no cgo and still cross-compile. It ships in
1161
- [govendor/](govendor/) with the other vendored modules and is linked only into programs that
1162
- use WebAssembly; it adds about 4 MB to a binary. Every instance is a module of one wazero
1163
- runtime, and imports link by reference: a memory two instances share is one memory.
1164
-
1165
- | API | Status | Probe | Notes |
1166
- | -------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1167
- | `new WASI({ version: 'preview1', args, env, preopens, returnOnExit, stdin, stdout, stderr })`, `getImportObject()`, `wasiImport` | ✅ | [lib-node-wasi.ts](conformance/lib-node-wasi.ts) | wazero's WASI preview1 with real clocks and randomness; `stdin` / `stdout` / `stderr` take `fs.open` descriptors; preopens mount host directories |
1168
- | `start(instance)` (returns `proc_exit`'s code), `initialize(instance)`, `ERR_WASI_ALREADY_STARTED` | ✅ | [lib-node-wasi.ts](conformance/lib-node-wasi.ts) | `returnOnExit: false` exits the process with the code |
1169
- | `version: 'unstable'` | ✅ | [lib-node-wasi-unstable.ts](conformance/lib-node-wasi-unstable.ts) | The legacy ABI's import module name — the same functions under `wasi_unstable`, linked by wazero's function exporter — with a guest that imports it |
1170
- | `WebAssembly.validate` / `compile` / `instantiate` (bytes → `{ module, instance }`, `Module` → `Instance`), `new Module` / `new Instance` | ✅ | [lib-webassembly-basic.ts](conformance/lib-webassembly-basic.ts) | The promises settle before they return: compilation runs on the event loop |
1171
- | Exported functions: i32 / f32 / f64 as numbers, i64 as bigints, multi-value results as arrays; imported JS functions | ✅ | [lib-webassembly-basic.ts](conformance/lib-webassembly-basic.ts) | A throw inside an imported function crosses the wasm frames unchanged; a trap is a `RuntimeError` with wazero's message (`unreachable`, …) |
1172
- | `Memory` (`buffer`, `grow`, `new Memory({ initial, maximum })`), `Global` (`value`, `valueOf`, `new Global({ value, mutable }, v)`) | ✅ | [lib-webassembly-linking.ts](conformance/lib-webassembly-linking.ts) | `buffer` views the memory's bytes; after `grow`, read it again (the old view is not detached). Shared (threads) memories are not supported |
1173
- | Linking: JS-made memories / globals, another instance's exports, numbers for immutable globals | ✅ | [lib-webassembly-linking.ts](conformance/lib-webassembly-linking.ts) | An instance's exported function, used as an import, is called through JS (not wasm to wasm) |
1174
- | `Module.imports` / `exports` / `customSections`, `CompileError` / `LinkError` / `RuntimeError` (`instanceof`) | ✅ | [lib-webassembly-basic.ts](conformance/lib-webassembly-basic.ts) | |
1175
- | `Table`: exported, then imported again (`length`) | ✅ | [lib-webassembly-linking.ts](conformance/lib-webassembly-linking.ts) | An exported `Table` imports by reference: `instanceof WebAssembly.Table`, `length` 2, and the second module's `table.size` matches |
1176
- | `new Table`, `table.get` / `set` / `grow`; tag / exception imports; `externref` tables | 🚫 | — | wazero v1.12 (the vendored runtime) exposes no table API — `api.Module` has a literal `TODO: Table` — and implements neither the exception-handling proposal (tags) nor host access to `externref` tables |
1177
- | `compileStreaming` / `instantiateStreaming` | ✅ | [lib-node-wasm-streaming.ts](conformance/lib-node-wasm-streaming.ts) | A `Response` (or a promise of one) whose MIME type is `application/wasm` is read and compiled, as Node runs it; non-`Response` sources and other MIME types reject with Node's errors |
1178
-
1179
- #### `node:sea`
1180
-
1181
- | API | Status | Probe | Notes |
1182
- | -------------------------------------- | :----: | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1183
- | `isSea` | ✅ | [lib-node-module-v8.ts](conformance/lib-node-module-v8.ts) | Always `true`: every TypeNative binary is a single executable |
1184
- | `getAsset` / `getRawAsset` (and `getAssetAsBlob`) with assets | ✅ | [lib-node-sea-assets.ts](conformance/lib-node-sea-assets.ts) | A `--sea-config <file>` build embeds the config's assets (`{ assets: { key: path } }`, paths relative to the config) into the binary as a generated Go file; without it the getters throw `ERR_SINGLE_EXECUTABLE_APPLICATION_ASSET_NOT_FOUND`, as Node's without an asset blob |
1185
-
1186
- #### `node:trace_events`
1187
-
1188
- | API | Status | Probe | Notes |
1189
- | ---------------------------------------- | :----: | ----- | ------------------------------------------------ |
1190
- | `createTracing` / `getEnabledCategories` | 🚫 | — | V8 / Node trace categories; no native equivalent |
1191
-
1192
- #### `node:module`
1193
-
1194
- | API | Status | Probe | Notes |
1195
- | ----------------------------------------------------------------------------- | :----: | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
1196
- | `builtinModules` / `isBuiltin` | ✅ | [lib-node-module-v8.ts](conformance/lib-node-module-v8.ts) | Node 22's list; `node:test`, `node:sqlite` and `node:sea` need the scheme, as in Node |
1197
- | `builtinModules` as Node 26 lists it | ✅ | [lib-node-module-v8.ts](conformance/lib-node-module-v8.ts) | Without `_stream_*`; the scheme-only modules listed with `node:` |
1198
- | `createRequire(import.meta.url)` and `require('./data.json')` | ✅ | [lib-json-modules.ts](conformance/lib-json-modules.ts) | JSON files only, read at compile time; `require` of a module reports an error (use `import`) |
1199
- | `findPackageJSON`, `require` of modules | ✅ | [lib-node-module-require.ts](conformance/lib-node-module-require.ts), [lib-node-process-node26.ts](conformance/lib-node-process-node26.ts) | `const x = require('spec')` (a literal, through `createRequire`) is a namespace import; `findPackageJSON` walks up at run time |
1200
- | `register` / `registerHooks` (loader hooks), `require` of computed specifiers | 🚫 | — | Hooks into a JavaScript loader; imports are resolved at compile time. **Node 26** runtime-deprecates `register` |
1201
-
1202
- #### `node:test/reporters`
1203
-
1204
- | API | Status | Probe | Notes |
1205
- | ------------------------------------------- | :----: | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1206
- | `tap` / `spec` / `dot` / `junit` as exports | ✅ | [lib-node-test-reporters.ts](conformance/lib-node-test-reporters.ts) | `tap` / `dot` / `junit` are generator functions over an event source (an array, an async generator, a stream such as `run()`'s); `spec` is a Transform stream for `compose()` — Node's output, byte for byte |
1207
- | `lcov` | ✅ | [lib-node-test-reporters.ts](conformance/lib-node-test-reporters.ts) | A Transform stream (`new lcov()`, `compose(lcov)`); writes one record per `test:coverage` event (see coverage in [test](#nodetest)) |
1208
-
1209
- #### `node:domain`
1210
-
1211
- | API | Status | Probe | Notes |
1212
- | ------------------- | :----: | ----- | ------------------- |
1213
- | `create` / `Domain` | 🚫 | — | Deprecated upstream |
1214
-
1215
- #### `node:ffi`
1216
-
1217
- | API | Status | Probe | Notes |
1218
- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1219
- | `dlopen` / `dlclose` / `dlsym`, `DynamicLibrary` (`path`, `symbols`, `getFunction(s)`, `getSymbol(s)`, `close`, `using`), wrappers' `.pointer`, every `types` name, Node's argument checks and errors | ✅ | [lib-node-ffi.ts](conformance/lib-node-ffi.ts) | **Node 26**. No cgo: `LoadLibrary` / `GetProcAddress` on Windows, the vendored `purego` (`dlopen`) on Linux / macOS; each signature becomes a `reflect.FuncOf` call through `purego.RegisterFunc`, so integer / float arguments follow the C ABI. `dlopen(null)` (the process image) is `RTLD_DEFAULT`; the BSDs and wasm throw `ERR_FFI_CALL_FAILED` |
1220
- | `registerCallback` / `unregisterCallback` / `refCallback` / `unrefCallback` | ✅ | [lib-node-ffi.ts](conformance/lib-node-ffi.ts) | A JS throw inside a callback is held and rethrown when the native call returns; trampolines can't be freed (an unregistered one returns 0), and `unrefCallback` keeps the function alive. On Windows callbacks take integer / pointer arguments only (`syscall.NewCallback`, ~2000 per process) |
1221
- | `get*` / `set*` (8- to 64-bit, `Float32` / `Float64`), `toString`, `toBuffer` / `toArrayBuffer` (`copy: false` views native memory), `export*`, `getRawPointer`, `suffix` | ✅ | [lib-node-ffi.ts](conformance/lib-node-ffi.ts) | Go's heap does not move, so `getRawPointer` stays valid while the value is reachable |
1222
- | `getCurrentEventLoop` | 🚫 | — | A compiled program has no libuv `uv_loop_t` to hand out: left out of the types |
1223
-
1224
- ### Go bridges (`go:*`)
1225
-
1226
- Status: ✅ probed, 🚫 can't work in a TypeNative program (see [Known limitations](#known-limitations-)).
1227
-
1228
- <!-- go-bridges:start -->
1229
-
1230
- | Module | Status | Probe | Notes |
1231
- | --------------------------- | :----: | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------- |
1232
- | `go:archive/tar` | ✅ | [lib-go-compress-extra.ts](conformance/lib-go-compress-extra.ts) | tar archive read/write |
1233
- | `go:archive/zip` | ✅ | [lib-go-archive.ts](conformance/lib-go-archive.ts) | ZIP archive read/write |
1234
- | `go:bufio` | ✅ | [lib-go-bufio.ts](conformance/lib-go-bufio.ts) | Buffered I/O |
1235
- | `go:bytes` | ✅ | [lib-go-bytes.ts](conformance/lib-go-bytes.ts) | Byte-slice utilities |
1236
- | `go:cmp` | ✅ | [lib-go-slices.ts](conformance/lib-go-slices.ts) | Ordered comparison primitives |
1237
- | `go:compress/bzip2` | ✅ | [lib-go-compress-extra.ts](conformance/lib-go-compress-extra.ts) | bzip2 decompression (read-only) |
1238
- | `go:compress/flate` | ✅ | [lib-go-compress-extra.ts](conformance/lib-go-compress-extra.ts) | DEFLATE compression |
1239
- | `go:compress/gzip` | ✅ | [lib-go-compress-gzip.ts](conformance/lib-go-compress-gzip.ts) | gzip read/write |
1240
- | `go:compress/lzw` | ✅ | [lib-go-compress-extra.ts](conformance/lib-go-compress-extra.ts) | LZW compression (GIF/PDF/TIFF) |
1241
- | `go:compress/zlib` | ✅ | [lib-go-compress-extra.ts](conformance/lib-go-compress-extra.ts) | zlib read/write |
1242
- | `go:container/heap` | ✅ | [lib-go-container-heap.ts](conformance/lib-go-container-heap.ts) | A TS class implementing `heap.Interface` (see Go interfaces below) |
1243
- | `go:container/list` | ✅ | [lib-go-containers.ts](conformance/lib-go-containers.ts) | Doubly linked list |
1244
- | `go:container/ring` | ✅ | [lib-go-containers.ts](conformance/lib-go-containers.ts) | Circular list |
1245
- | `go:context` | ✅ | [lib-go-sync.ts](conformance/lib-go-sync.ts) | Cancellation and deadlines |
1246
- | `go:crypto` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | Crypto constants and algorithm selection |
1247
- | `go:crypto/aes` | ✅ | [lib-go-crypto-aes.ts](conformance/lib-go-crypto-aes.ts) | AES encryption |
1248
- | `go:crypto/cipher` | ✅ | [lib-go-crypto-aes.ts](conformance/lib-go-crypto-aes.ts) | Block cipher modes (GCM, CBC, CTR) |
1249
- | `go:crypto/des` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | DES / triple DES (deprecated) |
1250
- | `go:crypto/dsa` | ✅ | [lib-go-crypto-more.ts](conformance/lib-go-crypto-more.ts) | DSA signatures (deprecated) |
1251
- | `go:crypto/ecdh` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | ECDH key exchange |
1252
- | `go:crypto/ecdsa` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | ECDSA signatures |
1253
- | `go:crypto/ed25519` | ✅ | [lib-go-ed25519.ts](conformance/lib-go-ed25519.ts) | Ed25519 signatures |
1254
- | `go:crypto/elliptic` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | Elliptic curves (legacy; use ecdh/ecdsa) |
1255
- | `go:crypto/fips140` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | FIPS 140-3 mode controls |
1256
- | `go:crypto/hkdf` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | HKDF key derivation |
1257
- | `go:crypto/hmac` | ✅ | [lib-go-crypto-hash.ts](conformance/lib-go-crypto-hash.ts) | HMAC keyed hashing |
1258
- | `go:crypto/hpke` | ✅ | [lib-go-crypto-more.ts](conformance/lib-go-crypto-more.ts) | HPKE encryption (RFC 9180) |
1259
- | `go:crypto/md5` | ✅ | [lib-go-crypto-hash.ts](conformance/lib-go-crypto-hash.ts) | MD5 hash |
1260
- | `go:crypto/mlkem` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | ML-KEM post-quantum key encapsulation |
1261
- | `go:crypto/mlkem/mlkemtest` | ✅ | [lib-go-crypto-more.ts](conformance/lib-go-crypto-more.ts) | Deterministic ML-KEM encapsulation |
1262
- | `go:crypto/pbkdf2` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | PBKDF2 key derivation |
1263
- | `go:crypto/rand` | ✅ | [lib-go-crypto-aes.ts](conformance/lib-go-crypto-aes.ts) | Cryptographically secure random bytes |
1264
- | `go:crypto/rc4` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | RC4 stream cipher (deprecated) |
1265
- | `go:crypto/rsa` | ✅ | [lib-go-rsa.ts](conformance/lib-go-rsa.ts) | RSA signatures / encryption |
1266
- | `go:crypto/sha1` | ✅ | [lib-go-crypto-hash.ts](conformance/lib-go-crypto-hash.ts) | SHA-1 hash |
1267
- | `go:crypto/sha256` | ✅ | [lib-go-hash.ts](conformance/lib-go-hash.ts) | SHA-224 / SHA-256 hashes |
1268
- | `go:crypto/sha3` | ✅ | [lib-go-crypto-extra.ts](conformance/lib-go-crypto-extra.ts) | SHA-3 / SHAKE hashes |
1269
- | `go:crypto/sha512` | ✅ | [lib-go-crypto-hash.ts](conformance/lib-go-crypto-hash.ts) | SHA-384 / SHA-512 family hashes |
1270
- | `go:crypto/subtle` | ✅ | [lib-go-crypto-aes.ts](conformance/lib-go-crypto-aes.ts) | Constant-time comparison primitives |
1271
- | `go:crypto/tls` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | TLS client/server; loopback probe is a later phase |
1272
- | `go:crypto/x509` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | X.509 certificates and revocation |
1273
- | `go:crypto/x509/pkix` | ✅ | [lib-go-crypto-keys.ts](conformance/lib-go-crypto-keys.ts) | X.509 ASN.1/PKIX structures |
1274
- | `go:database/sql` | ✅ | [lib-go-sql.ts](conformance/lib-go-sql.ts) | No std driver: registry and errors probed |
1275
- | `go:database/sql/driver` | ✅ | [lib-go-sql.ts](conformance/lib-go-sql.ts) | Driver interfaces and value converters |
1276
- | `go:debug/buildinfo` | ✅ | [lib-go-runtime-extra.ts](conformance/lib-go-runtime-extra.ts) | Build info from executables |
1277
- | `go:debug/dwarf` | ✅ | [lib-go-debug.ts](conformance/lib-go-debug.ts) | DWARF debug info parsing |
1278
- | `go:debug/elf` | ✅ | [lib-go-debug.ts](conformance/lib-go-debug.ts) | ELF object files |
1279
- | `go:debug/gosym` | ✅ | [lib-go-debug.ts](conformance/lib-go-debug.ts) | Go symbol tables |
1280
- | `go:debug/macho` | ✅ | [lib-go-debug.ts](conformance/lib-go-debug.ts) | Mach-O object files |
1281
- | `go:debug/pe` | ✅ | [lib-go-debug.ts](conformance/lib-go-debug.ts) | PE (Windows) object files |
1282
- | `go:debug/plan9obj` | ✅ | [lib-go-debug.ts](conformance/lib-go-debug.ts) | Plan 9 object files |
1283
- | `go:embed` | ✅ | [lib-go-embed.ts](conformance/lib-go-embed.ts) | `embed.string` / `bytes` / `files` compile to `//go:embed` vars |
1284
- | `go:encoding` | ✅ | [lib-go-encoding.ts](conformance/lib-go-encoding.ts) | Shared encoding interfaces |
1285
- | `go:encoding/ascii85` | ✅ | [lib-go-encoding-more.ts](conformance/lib-go-encoding-more.ts) | ascii85 encoding |
1286
- | `go:encoding/asn1` | ✅ | [lib-go-encoding-more.ts](conformance/lib-go-encoding-more.ts) | ASN.1 DER encoding |
1287
- | `go:encoding/base32` | ✅ | [lib-go-encoding-more.ts](conformance/lib-go-encoding-more.ts) | base32 encoding |
1288
- | `go:encoding/base64` | ✅ | [lib-go-encoding.ts](conformance/lib-go-encoding.ts) | base64 encoding |
1289
- | `go:encoding/binary` | ✅ | [lib-go-encoding-extra.ts](conformance/lib-go-encoding-extra.ts) | Binary packing / varints |
1290
- | `go:encoding/csv` | ✅ | [lib-go-csv.ts](conformance/lib-go-csv.ts) | CSV read/write |
1291
- | `go:encoding/gob` | ✅ | [lib-go-gob.ts](conformance/lib-go-gob.ts) | Go binary serialization |
1292
- | `go:encoding/hex` | ✅ | [lib-go-encoding.ts](conformance/lib-go-encoding.ts) | hex encoding |
1293
- | `go:encoding/json` | ✅ | [lib-go-encoding-more.ts](conformance/lib-go-encoding-more.ts) | JSON encode/decode |
1294
- | `go:encoding/pem` | ✅ | [lib-go-encoding-extra.ts](conformance/lib-go-encoding-extra.ts) | PEM encoding |
1295
- | `go:encoding/xml` | ✅ | [lib-go-encoding-extra.ts](conformance/lib-go-encoding-extra.ts) | XML read/write |
1296
- | `go:errors` | ✅ | [lib-go-errors.ts](conformance/lib-go-errors.ts) | Error creation / wrapping / inspection |
1297
- | `go:expvar` | ✅ | [lib-go-runtime.ts](conformance/lib-go-runtime.ts) | Public process variables |
1298
- | `go:flag` | ✅ | [lib-go-exec.ts](conformance/lib-go-exec.ts) | Command-line flag parsing |
1299
- | `go:fmt` | ✅ | [lib-go-fmt.ts](conformance/lib-go-fmt.ts) | Formatted I/O; integer verbs take TS numbers |
1300
- | `go:go/ast` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Go syntax tree |
1301
- | `go:go/build` | ✅ | [lib-go-gotypes.ts](conformance/lib-go-gotypes.ts) | Go package build metadata |
1302
- | `go:go/build/constraint` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Build-tag constraint parsing |
1303
- | `go:go/constant` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Untyped constant values |
1304
- | `go:go/doc` | ✅ | [lib-go-gotypes.ts](conformance/lib-go-gotypes.ts) | Go doc extraction |
1305
- | `go:go/doc/comment` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Doc comment parse/print |
1306
- | `go:go/format` | ✅ | [lib-go-gotools.ts](conformance/lib-go-gotools.ts) | Go source formatting |
1307
- | `go:go/importer` | ✅ | [lib-go-gotypes.ts](conformance/lib-go-gotypes.ts) | Export-data type importer |
1308
- | `go:go/parser` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Go source parser |
1309
- | `go:go/printer` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Go AST printer |
1310
- | `go:go/scanner` | ✅ | [lib-go-gotools-extra.ts](conformance/lib-go-gotools-extra.ts) | Go tokenizer |
1311
- | `go:go/token` | ✅ | [lib-go-gotools.ts](conformance/lib-go-gotools.ts) | Go tokens / positions |
1312
- | `go:go/types` | ✅ | [lib-go-gotypes.ts](conformance/lib-go-gotypes.ts) | Go type checker |
1313
- | `go:go/version` | ✅ | [lib-go-gotools.ts](conformance/lib-go-gotools.ts) | Go version comparison |
1314
- | `go:hash` | ✅ | [lib-go-hash.ts](conformance/lib-go-hash.ts) | Hash function interface |
1315
- | `go:hash/adler32` | ✅ | [lib-go-hash-extra.ts](conformance/lib-go-hash-extra.ts) | Adler-32 checksum |
1316
- | `go:hash/crc32` | ✅ | [lib-go-hash.ts](conformance/lib-go-hash.ts) | CRC-32 checksum |
1317
- | `go:hash/crc64` | ✅ | [lib-go-hash-extra.ts](conformance/lib-go-hash-extra.ts) | CRC-64 checksum |
1318
- | `go:hash/fnv` | ✅ | [lib-go-hash.ts](conformance/lib-go-hash.ts) | FNV-1 / FNV-1a hash |
1319
- | `go:hash/maphash` | ✅ | [lib-go-hash-extra.ts](conformance/lib-go-hash-extra.ts) | Seeded string hashing |
1320
- | `go:html` | ✅ | [lib-go-url.ts](conformance/lib-go-url.ts) | HTML escaping |
1321
- | `go:html/template` | ✅ | [lib-go-text-extra.ts](conformance/lib-go-text-extra.ts) | HTML templating (auto-escaped) |
1322
- | `go:image` | ✅ | [lib-go-image.ts](conformance/lib-go-image.ts) | 2D image interface |
1323
- | `go:image/color` | ✅ | [lib-go-image-extra.ts](conformance/lib-go-image-extra.ts) | Color types |
1324
- | `go:image/color/palette` | ✅ | [lib-go-image-extra.ts](conformance/lib-go-image-extra.ts) | Standard color palettes |
1325
- | `go:image/draw` | ✅ | [lib-go-image-extra.ts](conformance/lib-go-image-extra.ts) | Image compositing |
1326
- | `go:image/gif` | ✅ | [lib-go-image-extra.ts](conformance/lib-go-image-extra.ts) | GIF decode/encode |
1327
- | `go:image/jpeg` | ✅ | [lib-go-image-extra.ts](conformance/lib-go-image-extra.ts) | JPEG decode/encode |
1328
- | `go:image/png` | ✅ | [lib-go-image.ts](conformance/lib-go-image.ts) | PNG decode/encode |
1329
- | `go:index/suffixarray` | ✅ | [lib-go-text.ts](conformance/lib-go-text.ts) | Suffix-array substring search |
1330
- | `go:io` | ✅ | [lib-go-compress-gzip.ts](conformance/lib-go-compress-gzip.ts) | Core I/O interfaces (Reader/Writer) |
1331
- | `go:io/fs` | ✅ | [lib-go-path-fs.ts](conformance/lib-go-path-fs.ts) | Filesystem abstraction |
1332
- | `go:io/ioutil` | ✅ | [lib-go-path-fs.ts](conformance/lib-go-path-fs.ts) | Deprecated I/O helpers (Go 1.16) |
1333
- | `go:iter` | ✅ | [lib-go-collections.ts](conformance/lib-go-collections.ts) | Range-over-func iterators via `for…of`; `Pull` not bridged |
1334
- | `go:log` | ✅ | [lib-go-log.ts](conformance/lib-go-log.ts) | Logging to stderr |
1335
- | `go:log/slog` | ✅ | [lib-go-log.ts](conformance/lib-go-log.ts) | Structured logging |
1336
- | `go:log/syslog` | ✅ | [lib-go-syslog.ts](conformance/lib-go-syslog.ts) | Network syslog; Unix only (no Windows build, the probe skips it) |
1337
- | `go:maps` | ✅ | [lib-go-collections.ts](conformance/lib-go-collections.ts) | Generic map helpers |
1338
- | `go:math` | ✅ | [lib-go-math.ts](conformance/lib-go-math.ts) | Math functions |
1339
- | `go:math/big` | ✅ | [lib-go-big.ts](conformance/lib-go-big.ts) | Arbitrary-precision arithmetic |
1340
- | `go:math/bits` | ✅ | [lib-go-math-extra.ts](conformance/lib-go-math-extra.ts) | Bit operations |
1341
- | `go:math/cmplx` | ✅ | [lib-go-math-cmplx.ts](conformance/lib-go-math-cmplx.ts) | `complex128` values pass between calls opaquely |
1342
- | `go:math/rand` | ✅ | [lib-go-math-extra.ts](conformance/lib-go-math-extra.ts) | Pseudo-random numbers |
1343
- | `go:math/rand/v2` | ✅ | [lib-go-math-extra.ts](conformance/lib-go-math-extra.ts) | Pseudo-random numbers (v2 API) |
1344
- | `go:mime` | ✅ | [lib-go-encoding-extra.ts](conformance/lib-go-encoding-extra.ts) | MIME media types |
1345
- | `go:mime/multipart` | ✅ | [lib-go-misc.ts](conformance/lib-go-misc.ts) | Multipart forms |
1346
- | `go:mime/quotedprintable` | ✅ | [lib-go-encoding-more.ts](conformance/lib-go-encoding-more.ts) | Quoted-printable encoding |
1347
- | `go:net` | ✅ | [lib-go-net.ts](conformance/lib-go-net.ts) | Sockets (loopback TCP), addresses |
1348
- | `go:net/http` | ✅ | [lib-go-http.ts](conformance/lib-go-http.ts) | HTTP client/server (loopback) |
1349
- | `go:net/http/cgi` | ✅ | [lib-go-http-extra.ts](conformance/lib-go-http-extra.ts) | CGI request parsing |
1350
- | `go:net/http/cookiejar` | ✅ | [lib-go-net.ts](conformance/lib-go-net.ts) | Cookie jars (loopback) |
1351
- | `go:net/http/fcgi` | ✅ | [lib-go-fcgi.ts](conformance/lib-go-fcgi.ts) | FastCGI responder serving a TS `http.Handler` class |
1352
- | `go:net/http/httptest` | ✅ | [lib-go-http.ts](conformance/lib-go-http.ts) | HTTP test servers (loopback) |
1353
- | `go:net/http/httptrace` | ✅ | [lib-go-net.ts](conformance/lib-go-net.ts) | HTTP tracing hooks |
1354
- | `go:net/http/httputil` | ✅ | [lib-go-net.ts](conformance/lib-go-net.ts) | HTTP utilities (loopback) |
1355
- | `go:net/http/pprof` | ✅ | [lib-go-http-extra.ts](conformance/lib-go-http-extra.ts) | pprof HTTP handlers |
1356
- | `go:net/mail` | ✅ | [lib-go-encoding-extra.ts](conformance/lib-go-encoding-extra.ts) | Mail address parsing |
1357
- | `go:net/netip` | ✅ | [lib-go-encoding-extra.ts](conformance/lib-go-encoding-extra.ts) | IP address types |
1358
- | `go:net/rpc` | ✅ | [lib-go-rpc.ts](conformance/lib-go-rpc.ts) | TS class services: methods compile to `M(*Args, *Reply) error` |
1359
- | `go:net/rpc/jsonrpc` | ✅ | [lib-go-rpc.ts](conformance/lib-go-rpc.ts) | JSON-RPC codec (client, server and the wire format) |
1360
- | `go:net/smtp` | ✅ | [lib-go-smtp.ts](conformance/lib-go-smtp.ts) | SMTP client, against a TS server over loopback |
1361
- | `go:net/textproto` | ✅ | [lib-go-net.ts](conformance/lib-go-net.ts) | Text protocol I/O |
1362
- | `go:net/url` | ✅ | [lib-go-url.ts](conformance/lib-go-url.ts) | URL parsing |
1363
- | `go:os` | ✅ | [lib-go-os.ts](conformance/lib-go-os.ts) | OS files and processes |
1364
- | `go:os/exec` | ✅ | [lib-go-exec.ts](conformance/lib-go-exec.ts) | External commands |
1365
- | `go:os/signal` | ✅ | [lib-go-misc.ts](conformance/lib-go-misc.ts) | Signal notification (`Notify` + `Stop`) |
1366
- | `go:os/user` | ✅ | [lib-go-runtime-extra.ts](conformance/lib-go-runtime-extra.ts) | User lookup |
1367
- | `go:path` | ✅ | [lib-go-path-fs.ts](conformance/lib-go-path-fs.ts) | Slash-separated paths |
1368
- | `go:path/filepath` | ✅ | [lib-go-os.ts](conformance/lib-go-os.ts) | File paths |
1369
- | `go:reflect` | ✅ | [lib-go-text-extra.ts](conformance/lib-go-text-extra.ts) | Runtime reflection |
1370
- | `go:regexp` | ✅ | [lib-go-regexp.ts](conformance/lib-go-regexp.ts) | Regular expressions |
1371
- | `go:regexp/syntax` | ✅ | [lib-go-text-extra.ts](conformance/lib-go-text-extra.ts) | Regexp parse trees |
1372
- | `go:runtime` | ✅ | [lib-go-runtime.ts](conformance/lib-go-runtime.ts) | Runtime introspection |
1373
- | `go:runtime/coverage` | ✅ | [lib-go-coverage.ts](conformance/lib-go-coverage.ts) | Needs `--cover`; calls throw without it |
1374
- | `go:runtime/debug` | ✅ | [lib-go-runtime.ts](conformance/lib-go-runtime.ts) | Stack traces and GC stats |
1375
- | `go:runtime/metrics` | ✅ | [lib-go-runtime-extra.ts](conformance/lib-go-runtime-extra.ts) | Runtime metrics sampling |
1376
- | `go:runtime/pprof` | ✅ | [lib-go-runtime-extra.ts](conformance/lib-go-runtime-extra.ts) | Profiling data |
1377
- | `go:runtime/trace` | ✅ | [lib-go-runtime-extra.ts](conformance/lib-go-runtime-extra.ts) | Execution tracing |
1378
- | `go:slices` | ✅ | [lib-go-slices.ts](conformance/lib-go-slices.ts) | Generic slice helpers |
1379
- | `go:sort` | ✅ | [lib-go-sort.ts](conformance/lib-go-sort.ts) | Sorting |
1380
- | `go:strconv` | ✅ | [lib-go-strconv.ts](conformance/lib-go-strconv.ts) | String conversions |
1381
- | `go:strings` | ✅ | [lib-go-strings.ts](conformance/lib-go-strings.ts) | String utilities |
1382
- | `go:structs` | ✅ | [lib-go-lowlevel.ts](conformance/lib-go-lowlevel.ts) | `HostLayout` marker |
1383
- | `go:sync` | ✅ | [lib-go-sync.ts](conformance/lib-go-sync.ts) | Mutexes and wait groups |
1384
- | `go:sync/atomic` | ✅ | [lib-go-sync.ts](conformance/lib-go-sync.ts) | Atomic operations |
1385
- | `go:syscall` | ✅ | [lib-go-lowlevel.ts](conformance/lib-go-lowlevel.ts) | Portable subset probed; per-arch constants dropped |
1386
- | `go:testing` | ✅ | [lib-go-testing.ts](conformance/lib-go-testing.ts) | Helpers usable outside `go test` |
1387
- | `go:testing/cryptotest` | ✅ | [lib-go-testing-t.ts](conformance/lib-go-testing-t.ts) | Real `*testing.T` via `testing.Main`; refuses outside `go test` |
1388
- | `go:testing/fstest` | ✅ | [lib-go-testing.ts](conformance/lib-go-testing.ts) | `TestFS` over any `fs.FS` |
1389
- | `go:testing/iotest` | ✅ | [lib-go-testing.ts](conformance/lib-go-testing.ts) | Reader/writer test wrappers |
1390
- | `go:testing/quick` | ✅ | [lib-go-testing.ts](conformance/lib-go-testing.ts) | Property checks with TS callbacks |
1391
- | `go:testing/slogtest` | ✅ | [lib-go-testing-t.ts](conformance/lib-go-testing-t.ts) | Handler suite: `TestHandler`, and `Run` under `testing.Main` |
1392
- | `go:testing/synctest` | ✅ | [lib-go-testing-t.ts](conformance/lib-go-testing-t.ts) | Fake-time bubbles under `testing.Main` |
1393
- | `go:text/scanner` | ✅ | [lib-go-text.ts](conformance/lib-go-text.ts) | Text scanner |
1394
- | `go:text/tabwriter` | ✅ | [lib-go-text.ts](conformance/lib-go-text.ts) | Aligned text columns |
1395
- | `go:text/template` | ✅ | [lib-go-template.ts](conformance/lib-go-template.ts) | Text templating |
1396
- | `go:text/template/parse` | ✅ | [lib-go-text-extra.ts](conformance/lib-go-text-extra.ts) | Template parse trees |
1397
- | `go:time` | ✅ | [lib-go-time.ts](conformance/lib-go-time.ts) | Time and durations |
1398
- | `go:time/tzdata` | ✅ | [lib-go-runtime-extra.ts](conformance/lib-go-runtime-extra.ts) | Embedded timezone database (side-effect import) |
1399
- | `go:unicode` | ✅ | [lib-go-unicode.ts](conformance/lib-go-unicode.ts) | Unicode tables |
1400
- | `go:unicode/utf16` | ✅ | [lib-go-encoding-more.ts](conformance/lib-go-encoding-more.ts) | UTF-16 encoding |
1401
- | `go:unicode/utf8` | ✅ | [lib-go-unicode.ts](conformance/lib-go-unicode.ts) | UTF-8 encoding |
1402
- | `go:unique` | ✅ | [lib-go-collections.ts](conformance/lib-go-collections.ts) | Canonical values |
1403
- | `go:weak` | ✅ | [lib-go-lowlevel.ts](conformance/lib-go-lowlevel.ts) | Weak pointers |
1404
- | `go:plugin` | 🚫 | — | Loads plugins with `dlopen`: needs cgo and `-buildmode=plugin` (no Windows support) |
1405
- | `go:unsafe` | 🚫 | — | Raw pointer arithmetic and memory reinterpretation; TS values have no addresses |
1406
- | `go:runtime/race` | 🚫 | — | No public API: the race detector is a build mode (`-race`) that needs cgo |
1407
- | `go:runtime/cgo` | 🚫 | — | Links only with cgo and a C toolchain; `Handle` exists to pass Go values to C |
1408
-
1409
- <!-- go-bridges:end -->
1410
-
1411
- #### Go bridge semantics
1412
-
1413
- | Rule | Meaning |
1414
- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1415
- | Number conversion | All Go ints/floats map to TS `number`; args convert via `T(x)`, results read back via `float64(x)`. `int64`/`uint64` beyond 2^53 lose precision. |
1416
- | Throw on error | `(T, error)` results throw a `GoError` on failure; `error`-only calls throw as statements and yield the error value in value position ([lib-go-bridge-smoke.ts](conformance/lib-go-bridge-smoke.ts)). |
1417
- | Tuples | Multi-value results pack into a slice (TS tuple); `const [a, b] = f()` types each element (ints read as numbers). |
1418
- | Structs | `new pkg.T({...})` builds a composite literal (pointer when any method needs it); fields read/write directly, converting numbers both ways (`h.Size += 1`). Embedded structs promote their fields. |
1419
- | Type annotations | `pkg.T` in an annotation is the Go type (`let d: dwarf.Data \| null = null`, `(t: testing.T) => …`): a struct is a pointer when the package hands out `*T`, a value when it hands out `T` (`time.Time`) ([lib-go-debug.ts](conformance/lib-go-debug.ts)). |
1420
- | Named numerics | Typed constants (`time.Second`, `reflect.String`) stay typed in Go; arithmetic and `===` coerce the `number` side (`time.Second * 2`). Results read as numbers: `token.Token(n)` restores the methods. |
1421
- | Callbacks | Func-typed params and struct fields become Go closures with the exact Go signature (int params read as numbers, returns convert to the result type); a `(T, error)` callback returns `T` and a `nil` error; sync callbacks (sort, slices, strings, ...) run inline. |
1422
- | Generics | Type args are inferred from the arguments, including through constraints (`maps.Keys(m)` with `Map ~map[K]V`); unresolved ones become `any`. |
1423
- | printf verbs | With a literal format, numbers passed to `%d %x %o %b %c %U` convert to `int64`; scan into number refs with `%v`. |
1424
- | nil | `null` passes as `nil`; `x === null` on nil-able Go values (slices, maps, interfaces, pointers) is a real nil check. |
1425
- | Channels | `chan<T>(size?)` (a `chan T`) / `GoChan<T>` with `send`, `recv`, `close`; `for…of` ranges channels, `iter.Seq` and `iter.Seq2` (`for (const [k, v] of seq2)`) ([lib-go-builtin.ts](conformance/lib-go-builtin.ts)). |
1426
- | Out-params | `ref<T>(init?)` makes a pointer cell; `.value` reads and writes through it, also on `GoRef<T>` params ([lib-go-builtin.ts](conformance/lib-go-builtin.ts), [lib-go-rpc.ts](conformance/lib-go-rpc.ts)). |
1427
- | Byte slices | `[]byte` is `Uint8Array` (zero-copy); `number[]` converts per call (mutations of the copy are lost). |
1428
- | Maps | A TS record (`Record<K, V>`) passes where Go takes a `map[K]V` of the same key and value types, as a copy ([lib-go-testing-t.ts](conformance/lib-go-testing-t.ts)). |
1429
- | Side-effect imports | `import 'go:time/tzdata'` emits a blank `import _`. |
1430
- | Embedding | `const page = embed.string('./page.html')` (also `embed.bytes`, and `embed.files(...patterns)` for an `embed.FS`) compiles to a package-level `//go:embed` var. Only as a top-level initializer with literal paths, relative to the file; they must stay inside the entry file's directory, and `embed.FS` names are relative to it. The CLI copies the files next to the Go sources ([lib-go-embed.ts](conformance/lib-go-embed.ts)). |
1431
- | Coverage | `--cover` builds with `-cover -covermode=atomic`, so `go:runtime/coverage` has data to write; set `GOCOVERDIR` to also get a profile at exit ([lib-go-coverage.ts](conformance/lib-go-coverage.ts)). |
1432
- | Go interfaces | A TS class instance passed where Go expects an interface (`heap.Interface`, `sort.Interface`) is wrapped in a generated adapter with the exact Go method signatures (`Len() int` calls the class's `Len(): number`); the class needs every method, inherited ones count. Values typed as the interface itself are not adapted. |
1433
-
1434
- ### npm packages
1435
-
1436
- | Pattern | Status | Probe | Notes |
1437
- | ------------------------------------------------- | :----: | -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1438
- | `import { x } from 'pkg'` | ✅ | [syntax-import-npm.ts](conformance/syntax-import-npm.ts) | Mapped to Go module imports (fixture dep in [conformance/package.json](conformance/package.json)) |
1439
- | Packages published as plain JavaScript / CommonJS | 🚫 | — | Without TypeScript sources there are no types to compile from: untyped packages stop at the type check (TS7016), and typed ones whose code is CommonJS (`module.exports`, union-typed callbacks) don't lower. Packages that ship `.ts` sources work |
1440
-
1441
- ### Native app windows (`@webviewjs/webview`)
1442
-
1443
- Programs open windows through the [`@webviewjs/webview`](https://www.npmjs.com/package/@webviewjs/webview)
1444
- API, so the same source runs under Node.js (the real package) and compiled (a built-in
1445
- implementation, no npm package needed). Build a windowed app with `--gui`. Anything not listed
1446
- here is a type error when compiled.
1447
-
1448
- | API | Status | Probe | Notes |
1449
- | ----------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
1450
- | `new Application()`, `run`, `exit`, `isReady`, `whenReady` | ✅ | [lib-webview-api.ts](conformance/lib-webview-api.ts) | `ApplicationOptions` aren't accepted |
1451
- | `app.createWebContext({ dataDirectory })` | ✅ | [lib-webview-api.ts](conformance/lib-webview-api.ts) | Without one, compiled apps use the per-user cache folder |
1452
- | `app.createBrowserWindow({ title, width, height, logical, resizable })` | ✅ | [lib-webview-api.ts](conformance/lib-webview-api.ts) | Sizes are physical pixels unless `logical`, as in the package |
1453
- | `win.createWebview({ url, html, enableDevtools, webContext })` | ✅ | [lib-webview-api.ts](conformance/lib-webview-api.ts) | One webview per window, which opens once it has one. `enableDevtools` also enables the right-click menu |
1454
- | `win.setTitle`, `win.close` | ✅ | [lib-webview-api.ts](conformance/lib-webview-api.ts) | |
1455
- | `view.loadUrl`, `loadHtml`, `evaluateScript`, `reload` | ✅ | [lib-webview-api.ts](conformance/lib-webview-api.ts) | Once a browser app window is open these throw `ERR_WEBVIEW_UNSUPPORTED` |
1456
- | Events `ready`, `window-close-requested`, `application-close-requested`, window `close` | ✅ | [app-webview-window.ts](conformance/app-webview-window.ts) | A close from the program skips `close` and `window-close-requested`, as in the package |
1457
- | `event.preventDefault()` on `close` | 🚫 | — | The window is already gone when `close` arrives: save before it, for example on the page's `beforeunload` |
1458
- | Menus, tray icons, notifications, IPC (`expose`, `onIpcMessage`), custom protocols, window controls | ❌ | — | Not implemented |
1459
-
1460
- How a window is hosted:
1461
-
1462
- | Platform | Window | Closing it is detected by | Verified |
1463
- | ---------------------------------------- | -------------------------------------- | ------------------------------------- | ---------------------------------------------------------- |
1464
- | Windows | Embedded WebView2, pure Go, no cgo | The window's message loop ending | Run end to end |
1465
- | Windows without the WebView2 runtime | Edge or Chrome in app mode | A job object emptying | Run end to end (`TYPENATIVE_WEBVIEW=browser` forces this) |
1466
- | macOS, Linux | Chrome, Edge or Chromium in app mode | The DevTools pipe reporting the page closed | Builds in CI; **never run on these systems**, only the pipe's messages were checked on Windows |
1467
-
1468
- With no browser to open, opening the window throws `ERR_WEBVIEW_NO_BROWSER`. Run
1469
- [app-webview-window.ts](conformance/app-webview-window.ts) with `TN_WEBVIEW_SMOKE=1` to open a real
1470
- window: the suite skips it otherwise, since CI has no display.
1471
-
1472
- Under Node.js on Windows the package has a pitfall that compiled programs don't: while the window
1473
- is idle, its event pump can hold the JS thread until a window message arrives (seen on 0.6.0 and
1474
- 1.0.0-rc.4, and `controlFlow` doesn't change it), which starves timers and an HTTP server in the
1475
- same process. [desktop-notes](examples/desktop-notes/) gives the window its own process there. Its
1476
- default profile folder is beside `node.exe`, which is read-only under Program Files, so pass a
1477
- `dataDirectory`.
1478
-
1479
- ## Known limitations (🚫)
1480
-
1481
- These follow from compiling to a native Go binary, and won't change:
1482
-
1483
- - **No JavaScript engine at runtime**, so code can't be compiled while the program runs: `eval`,
1484
- `new Function`, `node:vm`, `node:repl`, Worker `eval: true`. Nothing can inspect an engine
1485
- either: `node:inspector`, `node:v8` heap snapshots and flags, `node:trace_events`, and
1486
- `node:module` loader hooks.
1487
- - **Classes are static Go structs** with fixed fields and method sets: no prototype mutation
1488
- (`C.prototype.m = …`, `Object.setPrototypeOf`, `util.inherits`), no `Proxy` over typed values,
1489
- no sparse-array holes.
1490
- - **`undefined` and `null` are both Go `nil`**, so APIs that tell them apart can't (`node:sqlite`
1491
- binding `undefined`).
1492
- - **One process per isolate**: workers, `fork` and cluster workers are separate processes, so
1493
- `SharedArrayBuffer` / `Atomics` can't share memory.
1494
- - **No cgo**: `go:plugin`, `go:runtime/cgo`, `go:runtime/race` (the race detector), and SQLite
1495
- native extensions (SQLite runs as Wasm translated to Go).
1496
- - **No raw memory**: `go:unsafe` reinterprets memory through pointers; TS values have no addresses.
1497
- - **Deprecated upstream**: `node:domain`, HTTP/2 server push, `util.inherits`.