typenative 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +2 -2
- package/.github/workflows/npm-publish-github-packages.yml +2 -2
- package/CHANGELOG.md +442 -1
- package/CONTRIBUTION.md +2 -1
- package/README.md +73 -25
- package/bin/cli.js +2 -0
- package/bin/index.js +75 -5
- package/bin/main.js +2 -0
- package/bin/node/assert.js +2 -2
- package/bin/node/async_hooks.js +1 -1
- package/bin/node/buffer.js +16 -5
- package/bin/node/child_process.js +7 -7
- package/bin/node/cluster.js +3 -3
- package/bin/node/core.js +41 -0
- package/bin/node/crypto_keys.js +21 -21
- package/bin/node/dgram.js +1 -1
- package/bin/node/diagnostics_channel.js +3 -3
- package/bin/node/dns.js +2 -2
- package/bin/node/events.js +18 -13
- package/bin/node/fetch.js +2 -2
- package/bin/node/fs.js +3 -3
- package/bin/node/fs_watch.js +5 -5
- package/bin/node/http.js +3 -3
- package/bin/node/http2.js +3 -3
- package/bin/node/net.js +8 -8
- package/bin/node/path.js +17 -3
- package/bin/node/process.js +47 -11
- package/bin/node/punycode.js +2 -2
- package/bin/node/readline.js +1 -1
- package/bin/node/registry.js +4 -1
- package/bin/node/sqlite.js +6 -6
- package/bin/node/stream.js +81 -15
- package/bin/node/stream_web.js +10 -10
- package/bin/node/system_extra.js +3 -3
- package/bin/node/test.js +674 -366
- package/bin/node/test_coverage.js +187 -0
- package/bin/node/test_report.js +1392 -0
- package/bin/node/test_run.js +575 -0
- package/bin/node/timers.js +8 -6
- package/bin/node/tls.js +5 -5
- package/bin/node/url.js +1 -1
- package/bin/node/util.js +31 -7
- package/bin/node/util_extra.js +7 -7
- package/bin/node/webview.js +654 -0
- package/bin/node/worker_threads.js +1 -1
- package/bin/node/zlib.js +3 -3
- package/bin/parse-node.js +6 -2
- package/bin/regex_vm.js +2057 -0
- package/bin/transpiler.js +32872 -11265
- package/bin/typecheck-node.js +2 -1
- package/bin/version.js +1 -1
- package/conformance.md +515 -345
- package/examples/README.md +71 -11
- package/examples/angular-templates/README.md +139 -0
- package/examples/angular-templates/bench.mjs +173 -0
- package/examples/angular-templates/dom-type-globals.d.ts +21 -0
- package/examples/angular-templates/dom-type-stubs.ts +21 -0
- package/examples/angular-templates/main.ts +135 -0
- package/examples/angular-templates/parity.mjs +157 -0
- package/examples/angular-templates/run-node.mjs +69 -0
- package/examples/angular-templates/vendor/angular/compiler/LICENSE +21 -0
- package/examples/desktop-notes/README.md +106 -0
- package/examples/desktop-notes/bench.mjs +125 -0
- package/examples/desktop-notes/main.ts +131 -0
- package/examples/desktop-notes/package-lock.json +726 -0
- package/examples/desktop-notes/package.json +9 -0
- package/examples/desktop-notes/ui.ts +176 -0
- package/examples/dupe-finder/README.md +78 -0
- package/examples/dupe-finder/bench.mjs +120 -0
- package/examples/dupe-finder/main.ts +87 -0
- package/examples/fibonacci/README.md +7 -7
- package/examples/hello-world/README.md +6 -6
- package/examples/json-server/README.md +19 -18
- package/examples/mandelbrot-png/README.md +63 -0
- package/examples/mandelbrot-png/bench.mjs +95 -0
- package/examples/mandelbrot-png/main.ts +98 -0
- package/examples/mandelbrot-png/preview.png +0 -0
- package/examples/marked-cli/README.md +160 -0
- package/examples/marked-cli/bench.mjs +178 -0
- package/examples/marked-cli/main.ts +292 -0
- package/examples/marked-cli/parity.mjs +185 -0
- package/examples/marked-cli/vendor/marked/LICENSE +44 -0
- package/examples/marked-cli/vendor/marked/VENDOR.md +26 -0
- package/examples/openai-chat/README.md +148 -0
- package/examples/openai-chat/bench.mjs +175 -0
- package/examples/openai-chat/main.ts +488 -0
- package/examples/react-compiler/README.md +170 -0
- package/examples/react-compiler/bench.mjs +181 -0
- package/examples/react-compiler/main.ts +158 -0
- package/examples/react-compiler/parity.mjs +362 -0
- package/examples/react-compiler/run-node.mjs +88 -0
- package/examples/react-compiler/vendor/babel/LICENSE +22 -0
- package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-lower.json +15 -0
- package/examples/react-compiler/vendor/babel/helper-globals/data/builtin-upper.json +51 -0
- package/examples/react-compiler/vendor/charcodes/package.json +25 -0
- package/examples/react-compiler/vendor/invariant/LICENSE +21 -0
- package/examples/react-compiler/vendor/invariant/invariant.cjs +51 -0
- package/examples/react-compiler/vendor/invariant/invariant.d.cts +11 -0
- package/examples/react-compiler/vendor/invariant/types/LICENSE +21 -0
- package/examples/react-compiler/vendor/jridgewell/gen-mapping/LICENSE +19 -0
- package/examples/react-compiler/vendor/jridgewell/resolve-uri/LICENSE +19 -0
- package/examples/react-compiler/vendor/jridgewell/sourcemap-codec/LICENSE +19 -0
- package/examples/react-compiler/vendor/jridgewell/trace-mapping/LICENSE +19 -0
- package/examples/react-compiler/vendor/js-tokens/LICENSE +21 -0
- package/examples/react-compiler/vendor/js-tokens/index.cjs +23 -0
- package/examples/react-compiler/vendor/js-tokens/index.d.cts +13 -0
- package/examples/react-compiler/vendor/jsesc/LICENSE-MIT.txt +20 -0
- package/examples/react-compiler/vendor/jsesc/jsesc.cjs +337 -0
- package/examples/react-compiler/vendor/jsesc/jsesc.d.cts +384 -0
- package/examples/react-compiler/vendor/jsesc/types/LICENSE +21 -0
- package/examples/react-compiler/vendor/picocolors/LICENSE +15 -0
- package/examples/react-compiler/vendor/picocolors/picocolors.cjs +75 -0
- package/examples/react-compiler/vendor/picocolors/picocolors.d.cts +5 -0
- package/examples/react-compiler/vendor/picocolors/types.d.ts +51 -0
- package/examples/react-compiler/vendor/react-compiler/LICENSE +21 -0
- package/examples/react-compiler/vendor/stubs/babel-core.ts +31 -0
- package/examples/react-compiler/vendor/stubs/debug.ts +18 -0
- package/examples/react-compiler/vendor/stubs/js-tokens.d.ts +13 -0
- package/examples/react-compiler/vendor/stubs/pretty-format.ts +18 -0
- package/examples/react-compiler/vendor/zod/LICENSE +21 -0
- package/examples/react-compiler/vendor/zod-validation-error/LICENSE +9 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/utils/NonEmptyArray.ts +5 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinPath.ts +49 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/utils/joinValues.ts +48 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/utils/stringify.ts +50 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/utils/titleCase.ts +6 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/MessageBuilder.ts +126 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/ValidationError.ts +39 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/custom.ts +12 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/errorMap.ts +78 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/index.ts +2 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidElement.ts +12 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidKey.ts +12 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidStringFormat.ts +131 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidType.ts +54 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidUnion.ts +12 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/invalidValue.ts +40 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/notMultipleOf.ts +12 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooBig.ts +76 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/tooSmall.ts +76 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/types.ts +27 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/errorMap/unrecognizedKeys.ts +27 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromError.ts +13 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodError.ts +61 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/fromZodIssue.ts +38 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/index.ts +20 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationError.ts +5 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isValidationErrorLike.ts +8 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/isZodErrorLike.ts +11 -0
- package/examples/react-compiler/vendor/zod-validation-error/lib/v4/toValidationError.ts +20 -0
- package/examples/react-compiler/vendor.mjs +688 -0
- package/examples/todo-cli/README.md +69 -0
- package/examples/todo-cli/bench.mjs +89 -0
- package/examples/todo-cli/main.ts +92 -0
- package/examples/yaml-cli/README.md +146 -0
- package/examples/yaml-cli/bench.mjs +265 -0
- package/examples/yaml-cli/main.ts +29 -0
- package/examples/yaml-cli/parity.mjs +156 -0
- package/examples/yaml-cli/vendor/yaml/LICENSE +13 -0
- package/examples/yaml-cli/vendor/yaml/VENDOR.md +25 -0
- package/govendor/github.com/jchv/go-webview2/LICENSE +22 -0
- package/govendor/github.com/jchv/go-webview2/README.md +21 -0
- package/govendor/github.com/jchv/go-webview2/common.go +84 -0
- package/govendor/github.com/jchv/go-webview2/go.mod +3 -0
- package/govendor/github.com/jchv/go-webview2/internal/w32/w32.go +194 -0
- package/govendor/github.com/jchv/go-webview2/internal/w32/w32_386.go +14 -0
- package/govendor/github.com/jchv/go-webview2/internal/w32/w32_64bit.go +15 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_COLOR.go +8 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_HOST_RESOURCE_ACCESS_KIND.go +9 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_KEY_EVENT_KIND.go +10 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_MOVE_FOCUS_REASON.go +9 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_PHYSICAL_KEY_STATUS.go +10 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/COREWEBVIEW2_WEB_RESOURCE_CONTEXT.go +23 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2AcceleratorKeyPressedEventArgs.go +78 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2AcceleratorKeyPressedEventHandler.go +52 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2Controller.go +132 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2Controller2.go +74 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2CreateCoreWebView2ControllerCompletedHandler.go +48 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2NavigationCompletedEventArgs.go +17 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2NavigationCompletedEventHandler.go +48 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2Settings.go +270 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceRequest.go +43 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceRequestedEventArgs.go +51 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceRequestedEventHandler.go +48 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2WebResourceResponse.go +21 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2_2.go +21 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebView2_3.go +60 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/ICoreWebViewSettings.go +396 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium.go +361 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium_386.go +24 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium_amd64.go +22 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/chromium_arm64.go +26 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/comproc.go +13 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/comproc_go17.go +51 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/comproc_go18.go +16 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/corewebview2.go +411 -0
- package/govendor/github.com/jchv/go-webview2/pkg/edge/guid.go +223 -0
- package/govendor/github.com/jchv/go-webview2/webview.go +482 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/README.md +3 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/module.go +153 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/module_386.go +6 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/module_amd64.go +6 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/module_arm64.go +6 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/sdk/arm64/WebView2Loader.dll +0 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/sdk/x64/WebView2Loader.dll +0 -0
- package/govendor/github.com/jchv/go-webview2/webviewloader/sdk/x86/WebView2Loader.dll +0 -0
- package/govendor/github.com/jchv/go-winloader/LICENSE.md +7 -0
- package/govendor/github.com/jchv/go-winloader/README.md +124 -0
- package/govendor/github.com/jchv/go-winloader/common.go +11 -0
- package/govendor/github.com/jchv/go-winloader/go.mod +3 -0
- package/govendor/github.com/jchv/go-winloader/internal/loader/loader.go +25 -0
- package/govendor/github.com/jchv/go-winloader/internal/loader/machine.go +53 -0
- package/govendor/github.com/jchv/go-winloader/internal/memloader/cache.go +42 -0
- package/govendor/github.com/jchv/go-winloader/internal/memloader/loader.go +253 -0
- package/govendor/github.com/jchv/go-winloader/internal/pe/export.go +76 -0
- package/govendor/github.com/jchv/go-winloader/internal/pe/format.go +522 -0
- package/govendor/github.com/jchv/go-winloader/internal/pe/import.go +106 -0
- package/govendor/github.com/jchv/go-winloader/internal/pe/module.go +91 -0
- package/govendor/github.com/jchv/go-winloader/internal/pe/reloc.go +177 -0
- package/govendor/github.com/jchv/go-winloader/internal/pe/util.go +40 -0
- package/govendor/github.com/jchv/go-winloader/internal/vmem/common.go +55 -0
- package/govendor/github.com/jchv/go-winloader/internal/vmem/memory_other.go +71 -0
- package/govendor/github.com/jchv/go-winloader/internal/vmem/memory_windows.go +179 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/hacks_other.go +17 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/hacks_windows.go +73 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/loader_windows.go +64 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/machine_windows.go +32 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/nativearch_386.go +9 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/nativearch_amd64.go +9 -0
- package/govendor/github.com/jchv/go-winloader/internal/winloader/nativearch_arm64.go +9 -0
- package/govendor/github.com/jchv/go-winloader/loader_other.go +24 -0
- package/govendor/github.com/jchv/go-winloader/loader_windows.go +33 -0
- package/govendor/manifest.txt +3 -1
- package/package.json +8 -5
- package/performance/README.md +195 -0
- package/performance/any-dynamic.ts +21 -0
- package/performance/any-record-view.ts +20 -0
- package/performance/arr-hof.ts +21 -0
- package/performance/arr-push-index.ts +15 -0
- package/performance/arr-sort.ts +21 -0
- package/performance/async-await.ts +24 -0
- package/performance/class-dispatch.ts +52 -0
- package/performance/events-emit.ts +27 -0
- package/performance/exc-throw-rare.ts +25 -0
- package/performance/exc-try-catch.ts +26 -0
- package/performance/fn-closures.ts +29 -0
- package/performance/fn-recursion-tree.ts +31 -0
- package/performance/gen-for-of.ts +46 -0
- package/performance/json-roundtrip.ts +27 -0
- package/performance/map-delete.ts +24 -0
- package/performance/map-string-keys.ts +22 -0
- package/performance/num-arith-loop.ts +14 -0
- package/performance/num-bitwise.ts +21 -0
- package/performance/num-mod-int.ts +16 -0
- package/performance/num-to-string.ts +16 -0
- package/performance/obj-alloc.ts +32 -0
- package/performance/regex-exec.ts +29 -0
- package/performance/regex-site.ts +28 -0
- package/performance/set-ops.ts +20 -0
- package/performance/str-char-scan.ts +35 -0
- package/performance/str-concat-plus.ts +18 -0
- package/performance/str-concat.ts +24 -0
- package/performance/str-short-scan.ts +26 -0
- package/performance/str-split-join.ts +23 -0
- package/performance/str-template.ts +16 -0
- package/performance/union-switch.ts +57 -0
- package/tsparser/check.go +2 -1
- package/tsparser/main.go +5 -0
- package/types/typenative-npm.d.ts +193 -4
- package/types/typenative.d.ts +138 -41
package/conformance.md
CHANGED
|
@@ -4,7 +4,8 @@ Every TypeScript language feature and standard-library API TypeNative aims to
|
|
|
4
4
|
support, split by area. Each ✅ row links to the [conformance/](conformance/)
|
|
5
5
|
probe that proves it transpiles correctly (`npm run conformance`, filter with an
|
|
6
6
|
optional substring: `node scripts/conformance.mjs <filter>`; `--native` runs the
|
|
7
|
-
self-hosted binary).
|
|
7
|
+
self-hosted binary). The same run also type-checks and builds every program in
|
|
8
|
+
[examples/](#examples).
|
|
8
9
|
|
|
9
10
|
| Status | Meaning |
|
|
10
11
|
| :----: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -45,6 +46,8 @@ declared there fails the type check before it reaches the transpiler. The
|
|
|
45
46
|
| Array destructuring | ✅ | [syntax-destructuring.ts](conformance/syntax-destructuring.ts) | Parenthesized initializers; elision and element/property reads |
|
|
46
47
|
| 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
48
|
| Destructuring with defaults | ✅ | [syntax-destructuring-defaults.ts](conformance/syntax-destructuring-defaults.ts) | Missing elements/properties take defaults (nil- and bounds-checked) |
|
|
49
|
+
| 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 |
|
|
50
|
+
| Array destructuring past the end without a default (`const [a] = []` gives `undefined`) | ❌ | — | The binding gets the element type's zero value (`''`, `0`) instead; give it a default |
|
|
48
51
|
| Destructured parameters | ✅ | [syntax-destructuring-params.ts](conformance/syntax-destructuring-params.ts) | `function f({ a, b }: T)`, `([x, y]: number[])` |
|
|
49
52
|
| 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 |
|
|
50
53
|
| Object shorthand | ✅ | [lib-go-container-heap.ts](conformance/lib-go-container-heap.ts) | `{ name, priority }` takes the fields from same-named variables |
|
|
@@ -56,148 +59,175 @@ declared there fails the type check before it reaches the transpiler. The
|
|
|
56
59
|
| Reading a missing key of a `Record` / `Map` of primitives (`rec[k] === undefined`) | ❌ | — | Gives the value type's zero value (`""`, `0`), so the comparison is `false`; test with `k in rec` / `map.has(k)` |
|
|
57
60
|
| Tuples | ✅ | [syntax-tuples.ts](conformance/syntax-tuples.ts) | `[string, number]` fixed-length arrays |
|
|
58
61
|
| Top-level / module-scope variables | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Functions see main-file top-level variables |
|
|
62
|
+
| 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 `_`) |
|
|
59
63
|
| Numeric separators | ✅ | [syntax-numeric-separators.ts](conformance/syntax-numeric-separators.ts) | `1_000_000` |
|
|
60
64
|
| Hex / octal / binary literals | ✅ | [syntax-numeric-literals.ts](conformance/syntax-numeric-literals.ts) | `0xFF`, `0o17`, `0b1010`, `1e3` |
|
|
61
65
|
| `var` declarations (hoisting) | ✅ | [syntax-var.ts](conformance/syntax-var.ts) | Function- and module-level `var` |
|
|
62
66
|
| `using` / `await using` declarations | ✅ | [syntax-using.ts](conformance/syntax-using.ts) | Disposed in reverse order when the block ends (`defer`); `[Symbol.dispose]` methods |
|
|
63
67
|
| 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` |
|
|
64
68
|
| Sparse-array holes | 🚫 | — | Slices have no holes: a hole would read as the zero value, not `undefined` |
|
|
69
|
+
| `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) |
|
|
70
|
+
| `$` in identifiers (`$EOF`, `obs$`, `$implicit`) | ✅ | [syntax-dollar-identifiers.ts](conformance/syntax-dollar-identifiers.ts) | Go names use `ǂ` for `$`; JSON keys keep `$` |
|
|
71
|
+
| `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()` |
|
|
65
72
|
|
|
66
73
|
## Operators
|
|
67
74
|
|
|
68
|
-
| Feature
|
|
69
|
-
|
|
|
70
|
-
| Arithmetic operators
|
|
71
|
-
| Exponent operator
|
|
72
|
-
| Bitwise operators
|
|
73
|
-
| Unsigned shift
|
|
74
|
-
| Comparison operators
|
|
75
|
-
| Logical operators
|
|
76
|
-
| Increment / decrement
|
|
77
|
-
| Non-null assertion (`!`)
|
|
78
|
-
| Ternary expressions
|
|
79
|
-
| Nullish coalescing
|
|
80
|
-
| Optional chaining
|
|
81
|
-
| Nullish / logical assignment
|
|
82
|
-
| `in` operator
|
|
83
|
-
| `typeof`
|
|
84
|
-
| `instanceof`
|
|
85
|
-
| JS truthiness
|
|
86
|
-
| Loose equality (`==`)
|
|
87
|
-
| Optional call (`fn?.()`)
|
|
88
|
-
| Comma operator
|
|
89
|
-
| `void` operator
|
|
90
|
-
| `new.target`
|
|
91
|
-
| `instanceof Map` / `Set` / `Date` / `Array`, subclass instances
|
|
92
|
-
| `#x in obj` (private brand checks)
|
|
75
|
+
| Feature | Status | Probe | Notes |
|
|
76
|
+
| ----------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
77
|
+
| Arithmetic operators | ✅ | [syntax-arithmetic.ts](conformance/syntax-arithmetic.ts) | `+`, `-`, etc.; `%`/`%=` via `math.Mod` |
|
|
78
|
+
| Exponent operator | ✅ | [syntax-exponent.ts](conformance/syntax-exponent.ts) | `2 ** 10` |
|
|
79
|
+
| Bitwise operators | ✅ | [syntax-bitwise.ts](conformance/syntax-bitwise.ts) | `&`, `\|`, `^`, `<<`, `>>` |
|
|
80
|
+
| Unsigned shift | ✅ | [syntax-unsigned-shift.ts](conformance/syntax-unsigned-shift.ts) | `>>>` |
|
|
81
|
+
| Comparison operators | ✅ | [syntax-variables.ts](conformance/syntax-variables.ts) | `==`, `!=`, `===`, `!==`, etc. |
|
|
82
|
+
| Logical operators | ✅ | [syntax-variables.ts](conformance/syntax-variables.ts) | `&&`, `\|\|` |
|
|
83
|
+
| Increment / decrement | ✅ | [syntax-increment-expression.ts](conformance/syntax-increment-expression.ts) | `++`, `--`, incl. as expressions |
|
|
84
|
+
| Non-null assertion (`!`) | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Stripped during transpilation |
|
|
85
|
+
| Ternary expressions | ✅ | [syntax-ternary.ts](conformance/syntax-ternary.ts) | `condition ? a : b` |
|
|
86
|
+
| Nullish coalescing | ✅ | [syntax-nullish.ts](conformance/syntax-nullish.ts) | `??` operator, incl. chains |
|
|
87
|
+
| Optional chaining | ✅ | [syntax-optional-chaining.ts](conformance/syntax-optional-chaining.ts) | `obj?.prop`, `arr?.[i]`, chains across calls |
|
|
88
|
+
| Nullish / logical assignment | ✅ | [syntax-logical-assignment.ts](conformance/syntax-logical-assignment.ts) | `??=`, `\|\|=`, `&&=` |
|
|
89
|
+
| `in` operator | ✅ | [syntax-in-operator.ts](conformance/syntax-in-operator.ts) | `"key" in obj` on records |
|
|
90
|
+
| `typeof` | ✅ | [syntax-typeof.ts](conformance/syntax-typeof.ts) | `typeof x === "string"`; `"function"` for function values |
|
|
91
|
+
| `instanceof` | ✅ | [syntax-instanceof.ts](conformance/syntax-instanceof.ts) | User classes, `Error` classes and Node globals (`URL`, `Uint8Array`, …) |
|
|
92
|
+
| JS truthiness | ✅ | [syntax-optional-params.ts](conformance/syntax-optional-params.ts) | `if (str)`, `!count`, `a \|\| fallback` on any type |
|
|
93
|
+
| 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`) |
|
|
94
|
+
| Optional call (`fn?.()`) | ✅ | [syntax-optional-call.ts](conformance/syntax-optional-call.ts) | Nil check on the function value; result is nullable |
|
|
95
|
+
| Comma operator | ✅ | [syntax-comma-operator.ts](conformance/syntax-comma-operator.ts) | In `for` headers (`i = 0, j = 10` / `i++, j--`) |
|
|
96
|
+
| `void` operator | ✅ | [syntax-void-operator.ts](conformance/syntax-void-operator.ts) | Evaluates, then `nil` |
|
|
97
|
+
| `new.target` | ✅ | [syntax-new-target.ts](conformance/syntax-new-target.ts) | Constructors pass the target class name through `super()` chains |
|
|
98
|
+
| `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 |
|
|
99
|
+
| `#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 |
|
|
100
|
+
| 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 |
|
|
101
|
+
| `x?.m()` on an `any` value when `m` has a known primitive result (`s?.toUpperCase()`) | ❌ | — | A nullish `x` gives the type's zero value (`''`, `0`) instead of `undefined`, so `?? fallback` does not apply |
|
|
102
|
+
| 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 |
|
|
93
103
|
|
|
94
104
|
## Control flow
|
|
95
105
|
|
|
96
|
-
| Feature
|
|
97
|
-
|
|
|
98
|
-
| If / else statements
|
|
99
|
-
| Switch statements
|
|
100
|
-
| Switch fallthrough
|
|
101
|
-
| `for` loops
|
|
102
|
-
| `continue`
|
|
103
|
-
| `break`
|
|
104
|
-
| `for...of` loops
|
|
105
|
-
| `for...in` loops
|
|
106
|
-
| `for await...of`
|
|
107
|
-
| `while` loops
|
|
108
|
-
| `do...while` loops
|
|
109
|
-
| Labeled loops
|
|
110
|
-
| `try` / `catch` / `finally`
|
|
111
|
-
| Optional catch binding (`catch {}`)
|
|
112
|
-
| Custom error classes
|
|
113
|
-
| `Error.message`
|
|
114
|
-
| `Error` `cause` (`new Error(message, { cause })`, `err.cause`)
|
|
115
|
-
| Narrowing
|
|
116
|
-
| Exhaustive `switch` without `default`; statements after a `switch`
|
|
117
|
-
| Labeled blocks and statements (`label: { … break label; }`)
|
|
118
|
-
| Throwing non-`Error` values (`throw 'x'`, `throw { code: 1 }`)
|
|
119
|
-
| `debugger`
|
|
120
|
-
| `with`
|
|
106
|
+
| Feature | Status | Probe | Notes |
|
|
107
|
+
| -------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
|
|
108
|
+
| If / else statements | ✅ | [syntax-if-switch.ts](conformance/syntax-if-switch.ts) | Incl. unbraced bodies and else-if chains |
|
|
109
|
+
| Switch statements | ✅ | [syntax-switch.ts](conformance/syntax-switch.ts) | Case and default statements |
|
|
110
|
+
| Switch fallthrough | ✅ | [syntax-switch-fallthrough.ts](conformance/syntax-switch-fallthrough.ts) | Explicit fallthrough between cases |
|
|
111
|
+
| `for` loops | ✅ | [syntax-loops.ts](conformance/syntax-loops.ts) | Standard `for` loops, incl. unbraced bodies |
|
|
112
|
+
| `continue` | ✅ | [syntax-loops.ts](conformance/syntax-loops.ts) | `continue` in all loop kinds |
|
|
113
|
+
| `break` | ✅ | [syntax-if-switch.ts](conformance/syntax-if-switch.ts), [syntax-do-while.ts](conformance/syntax-do-while.ts) | In switch cases and loops |
|
|
114
|
+
| `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 |
|
|
115
|
+
| `for...in` loops | ✅ | [syntax-for-in.ts](conformance/syntax-for-in.ts) | Key range over records/maps |
|
|
116
|
+
| `for await...of` | ✅ | [syntax-for-await.ts](conformance/syntax-for-await.ts) | Ranges over the async generator's channel |
|
|
117
|
+
| `while` loops | ✅ | [syntax-loops.ts](conformance/syntax-loops.ts) | Transpiled to Go's `for` loops; assignment in condition |
|
|
118
|
+
| `do...while` loops | ✅ | [syntax-do-while.ts](conformance/syntax-do-while.ts) | Implemented with conditional break |
|
|
119
|
+
| Labeled loops | ✅ | [syntax-labeled-loops.ts](conformance/syntax-labeled-loops.ts) | `LabeledStatement` → Go labels; labeled `continue`/`break` |
|
|
120
|
+
| `try` / `catch` / `finally` | ✅ | [syntax-try-catch-finally.ts](conformance/syntax-try-catch-finally.ts) | `throw` → `panic`; catch/finally via `defer`/`recover` |
|
|
121
|
+
| Optional catch binding (`catch {}`) | ✅ | [syntax-try-catch-finally.ts](conformance/syntax-try-catch-finally.ts) | |
|
|
122
|
+
| Custom error classes | ✅ | [syntax-custom-errors.ts](conformance/syntax-custom-errors.ts) | `extends Error` → embedded `TnError`; constructors take the message |
|
|
123
|
+
| `Error.message` | ✅ | [syntax-error-message.ts](conformance/syntax-error-message.ts) | `throw new Error` panics with a `*TnError`; `.message` on caught values |
|
|
124
|
+
| `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 |
|
|
125
|
+
| Narrowing | ✅ | [syntax-typeof.ts](conformance/syntax-typeof.ts) | `T \| undefined` narrowed after `if (x)`, `x !== undefined`, early returns |
|
|
126
|
+
| 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`) |
|
|
127
|
+
| Labeled blocks and statements (`label: { … break label; }`) | ✅ | [syntax-labeled-blocks.ts](conformance/syntax-labeled-blocks.ts) | `break label` jumps past the statement (`goto`) |
|
|
128
|
+
| Throwing non-`Error` values (`throw 'x'`, `throw { code: 1 }`) | ✅ | — | Caught as `interface{}`; properties read dynamically |
|
|
129
|
+
| `debugger` | ✅ | — | Erased |
|
|
130
|
+
| `with` | 🚫 | — | Not allowed in strict mode (modules are strict) |
|
|
131
|
+
| 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 |
|
|
132
|
+
| `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 |
|
|
133
|
+
| `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) | |
|
|
121
134
|
|
|
122
135
|
## Functions
|
|
123
136
|
|
|
124
|
-
| Feature
|
|
125
|
-
|
|
|
126
|
-
| Function declarations
|
|
127
|
-
| Arrow functions
|
|
128
|
-
| IIFEs
|
|
129
|
-
| Closures over mutable state
|
|
130
|
-
| Function types
|
|
131
|
-
| Default parameter values
|
|
132
|
-
| Rest parameters
|
|
133
|
-
| Spread in calls
|
|
134
|
-
| Optional parameters
|
|
135
|
-
| Destructured parameters
|
|
136
|
-
| Contextual object-literal arguments
|
|
137
|
-
| Recursion
|
|
138
|
-
| Recursive arrow functions
|
|
139
|
-
| Generators (`function*` / `yield` / `yield*`)
|
|
140
|
-
| Async generators (`async function*`)
|
|
141
|
-
| Custom iterators (`Symbol.iterator`)
|
|
142
|
-
| `as const` assertions
|
|
143
|
-
| Function overloads
|
|
144
|
-
| `this` parameter (`function f(this: T)`)
|
|
145
|
-
| `arguments` object
|
|
146
|
-
| Top-level `await`
|
|
147
|
-
| Generator `next()`
|
|
148
|
-
| Generator `next(value)` (sending a value in) / `return()` / `throw()`
|
|
149
|
-
| `fn.call` / `fn.apply` / `fn.bind`
|
|
150
|
-
| `fn.name` / `fn.length`
|
|
151
|
-
| `eval` / `new Function(…)`
|
|
137
|
+
| Feature | Status | Probe | Notes |
|
|
138
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
139
|
+
| Function declarations | ✅ | [syntax-functions.ts](conformance/syntax-functions.ts) | Transpiled to Go functions |
|
|
140
|
+
| Arrow functions | ✅ | [syntax-arrow-functions.ts](conformance/syntax-arrow-functions.ts) | Transpiled to anonymous functions |
|
|
141
|
+
| IIFEs | ✅ | [syntax-iife.ts](conformance/syntax-iife.ts) | `(() => { ... })()` and `(function name() { ... })()` |
|
|
142
|
+
| Closures over mutable state | ✅ | [syntax-closures.ts](conformance/syntax-closures.ts) | Functions capturing and mutating outer variables; per-iteration `let` |
|
|
143
|
+
| Function types | ✅ | [syntax-closures.ts](conformance/syntax-closures.ts) | `() => number`, `(x: number) => string` as type annotations |
|
|
144
|
+
| Default parameter values | ✅ | [syntax-default-params.ts](conformance/syntax-default-params.ts) | `function(x = defaultValue)`, incl. constructors, methods, arrows |
|
|
145
|
+
| Rest parameters | ✅ | [syntax-rest-params.ts](conformance/syntax-rest-params.ts) | `function(...args: T[])` → Go variadic |
|
|
146
|
+
| Spread in calls | ✅ | [syntax-spread-call.ts](conformance/syntax-spread-call.ts) | `f(...args)` incl. tuples |
|
|
147
|
+
| Optional parameters | ✅ | [syntax-optional-params.ts](conformance/syntax-optional-params.ts) | `function f(x?: string)` |
|
|
148
|
+
| Destructured parameters | ✅ | [syntax-destructuring-params.ts](conformance/syntax-destructuring-params.ts) | `function f({ a, b }: T)`, `([x, y]: number[])` |
|
|
149
|
+
| Contextual object-literal arguments | ✅ | [syntax-contextual-arguments.ts](conformance/syntax-contextual-arguments.ts) | Struct type inferred from parameter / return type |
|
|
150
|
+
| Recursion | ✅ | [syntax-recursion.ts](conformance/syntax-recursion.ts) | Direct self-recursion |
|
|
151
|
+
| Recursive arrow functions | ✅ | [syntax-recursive-arrow.ts](conformance/syntax-recursive-arrow.ts) | `const f = () => … f() …` → declared, then assigned |
|
|
152
|
+
| 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 |
|
|
153
|
+
| Async generators (`async function*`) | ✅ | [syntax-async-generators.ts](conformance/syntax-async-generators.ts) | Goroutine + channel, consumed with `for await` |
|
|
154
|
+
| Custom iterators (`Symbol.iterator`) | ✅ | [syntax-custom-iterators.ts](conformance/syntax-custom-iterators.ts) | `*[Symbol.iterator]()` → a `Symbol_iterator()` channel method |
|
|
155
|
+
| `as const` assertions | ✅ | [syntax-as-const.ts](conformance/syntax-as-const.ts) | Erased during transpilation |
|
|
156
|
+
| Function overloads | ✅ | [syntax-function-overloads.ts](conformance/syntax-function-overloads.ts) | Signatures are erased; the implementation is emitted |
|
|
157
|
+
| `this` parameter (`function f(this: T)`) | ✅ | [syntax-this-parameter.ts](conformance/syntax-this-parameter.ts) | Erased |
|
|
158
|
+
| `arguments` object | ✅ | [syntax-arguments.ts](conformance/syntax-arguments.ts) | Functions reading it take extra arguments variadically (`[]interface{}`) |
|
|
159
|
+
| Top-level `await` | ✅ | — | In modules (files with an `import` / `export`) |
|
|
160
|
+
| Generator `next()` | ✅ | [lib-iterator-helpers.ts](conformance/lib-iterator-helpers.ts) | `{ value, done }` |
|
|
161
|
+
| Generator `next(value)` (sending a value in) / `return()` / `throw()` | ❌ | — | Generators are goroutines feeding a channel: values only flow out |
|
|
162
|
+
| `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) |
|
|
163
|
+
| `fn.name` / `fn.length` | ✅ | [syntax-function-values.ts](conformance/syntax-function-values.ts) | Known at compile time for declared functions, classes and function variables |
|
|
164
|
+
| `eval` / `new Function(…)` | 🚫 | — | Compile and run JavaScript at runtime: needs a JavaScript engine |
|
|
165
|
+
| 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 |
|
|
166
|
+
| `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) |
|
|
167
|
+
| 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 |
|
|
168
|
+
| 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 |
|
|
169
|
+
| 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 |
|
|
170
|
+
| `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 |
|
|
171
|
+
| 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 |
|
|
172
|
+
| 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) |
|
|
173
|
+
| 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 |
|
|
152
174
|
|
|
153
175
|
## Classes & interfaces
|
|
154
176
|
|
|
155
|
-
| Feature
|
|
156
|
-
|
|
|
157
|
-
| Classes
|
|
158
|
-
| Constructor parameter properties
|
|
159
|
-
| Class inheritance
|
|
160
|
-
| `implements` clauses
|
|
161
|
-
| Interface `extends`
|
|
162
|
-
| Static members
|
|
163
|
-
| Getters / setters (classes)
|
|
164
|
-
| Getters (object literals)
|
|
165
|
-
| Object-literal methods
|
|
166
|
-
| Private `#` fields
|
|
167
|
-
| Access modifiers (`private` / `protected` / `public` on members)
|
|
168
|
-
| Abstract classes
|
|
169
|
-
| Static initialization blocks (`static {}`)
|
|
170
|
-
| Class expressions (`const C = class {}`)
|
|
171
|
-
| Interfaces
|
|
172
|
-
| Optional properties
|
|
173
|
-
| Type-aware method dispatch
|
|
174
|
-
| Index signatures (`[key: string]: T`)
|
|
175
|
-
| Methods without a return-type annotation
|
|
176
|
-
| Field initializers reading parameter properties or parent fields
|
|
177
|
-
| Arrow-function fields (`h = () => this.x`), fields reading earlier fields
|
|
178
|
-
| Private methods (`#m()`)
|
|
179
|
-
| A private and a public member with the same name (`#x` and `x`)
|
|
180
|
-
| Private accessors (`get #x()`) / static private fields (`static #x`)
|
|
181
|
-
| `accessor` fields
|
|
182
|
-
| Static inheritance (`Child.staticOfParent()`)
|
|
183
|
-
| Inherited getters / setters, `super.x` on accessors
|
|
184
|
-
| Object-literal setters (`set x(v) {}`)
|
|
185
|
-
| Mixins (class factories, `return class extends Base {}`, `class extends f()`)
|
|
186
|
-
| Polymorphic `this` return types (fluent chains)
|
|
187
|
-
| Dynamic keys on class instances and typed objects (`inst[key]`)
|
|
188
|
-
| Declaration merging (interface + interface, enum + enum, class + interface)
|
|
189
|
-
| Prototype mutation (`C.prototype.m = …`, `Object.setPrototypeOf`, `util.inherits`)
|
|
177
|
+
| Feature | Status | Probe | Notes |
|
|
178
|
+
| ---------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
179
|
+
| Classes | ✅ | [syntax-class.ts](conformance/syntax-class.ts) | Transpiled to Go structs with constructor and receiver methods |
|
|
180
|
+
| Constructor parameter properties | ✅ | [syntax-class-parameter-properties.ts](conformance/syntax-class-parameter-properties.ts) | `constructor(private x: number)` |
|
|
181
|
+
| Class inheritance | ✅ | [syntax-class-inheritance.ts](conformance/syntax-class-inheritance.ts) | `super.method()` → `self.Parent.method()`; inherited methods copied for `this` dispatch |
|
|
182
|
+
| `implements` clauses | ✅ | [syntax-class-implements.ts](conformance/syntax-class-implements.ts) | `class C implements I` |
|
|
183
|
+
| Interface `extends` | ✅ | [syntax-interface-extends.ts](conformance/syntax-interface-extends.ts) | Inherited properties flattened into the derived struct |
|
|
184
|
+
| Static members | ✅ | [syntax-class-static.ts](conformance/syntax-class-static.ts) | Static members → package-level `Class_member` vars/functions |
|
|
185
|
+
| Getters / setters (classes) | ✅ | [syntax-class-getters.ts](conformance/syntax-class-getters.ts) | `c.v` reads/writes rewrite to `Get_v()`/`Set_v()` accessor calls |
|
|
186
|
+
| Getters (object literals) | ✅ | [syntax-object-getters.ts](conformance/syntax-object-getters.ts) | Getter closures stored as function fields; reads invoke them |
|
|
187
|
+
| Object-literal methods | ✅ | [syntax-object-methods.ts](conformance/syntax-object-methods.ts) | Method closures stored as function fields capturing the instance (`this` → the object) |
|
|
188
|
+
| 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` |
|
|
189
|
+
| Access modifiers (`private` / `protected` / `public` on members) | ✅ | [syntax-access-modifiers.ts](conformance/syntax-access-modifiers.ts) | `private` / `protected` / `public` are erased |
|
|
190
|
+
| Abstract classes | ✅ | [syntax-class-abstract.ts](conformance/syntax-class-abstract.ts) | Abstract members skipped; concrete methods copied onto subclasses |
|
|
191
|
+
| Static initialization blocks (`static {}`) | ✅ | [syntax-static-blocks.ts](conformance/syntax-static-blocks.ts) | Go `func init()` |
|
|
192
|
+
| Class expressions (`const C = class {}`) | ✅ | [syntax-class-expressions.ts](conformance/syntax-class-expressions.ts) | `const C = class {…}` becomes a class named after the variable |
|
|
193
|
+
| Interfaces | ✅ | [syntax-class-implements.ts](conformance/syntax-class-implements.ts) | Transpiled to Go interfaces |
|
|
194
|
+
| Optional properties | ✅ | [syntax-optional-chaining.ts](conformance/syntax-optional-chaining.ts) | `prop?: Type` in interfaces/types |
|
|
195
|
+
| Type-aware method dispatch | ✅ | [semantics-method-dispatch.ts](conformance/semantics-method-dispatch.ts) | Class `.push()` / `.length` not confused with array builtins |
|
|
196
|
+
| 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) |
|
|
197
|
+
| 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 |
|
|
198
|
+
| 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) |
|
|
199
|
+
| Arrow-function fields (`h = () => this.x`), fields reading earlier fields | ✅ | — | Run in the constructor; `this` is the instance |
|
|
200
|
+
| Private methods (`#m()`) | ✅ | [syntax-method-return-inference.ts](conformance/syntax-method-return-inference.ts) | |
|
|
201
|
+
| 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` |
|
|
202
|
+
| 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) | |
|
|
203
|
+
| `accessor` fields | ✅ | — | Plain fields (decorating them is not supported) |
|
|
204
|
+
| 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 |
|
|
205
|
+
| 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 |
|
|
206
|
+
| 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 |
|
|
207
|
+
| Mixins (class factories, `return class extends Base {}`, `class extends f()`) | ❌ | — | `Unsupported syntax: ClassExpression` outside `const C = class {}` |
|
|
208
|
+
| 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 |
|
|
209
|
+
| 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 |
|
|
210
|
+
| 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 |
|
|
211
|
+
| Prototype mutation (`C.prototype.m = …`, `Object.setPrototypeOf`, `util.inherits`) | 🚫 | — | Classes are static Go structs with fixed method sets |
|
|
212
|
+
| 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 |
|
|
213
|
+
| `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` |
|
|
214
|
+
| 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 |
|
|
215
|
+
| 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 |
|
|
216
|
+
| `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 |
|
|
217
|
+
| `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 |
|
|
190
218
|
|
|
191
219
|
## Generics
|
|
192
220
|
|
|
193
|
-
| Feature
|
|
194
|
-
|
|
|
195
|
-
| Generic functions
|
|
196
|
-
| Generic classes
|
|
197
|
-
| Generic constraints (`<T extends U>`)
|
|
198
|
-
| Default type parameters (`<T = D>`)
|
|
199
|
-
| Generic interfaces / type aliases
|
|
200
|
-
| `const` type parameters / variance annotations (`in` / `out`)
|
|
221
|
+
| Feature | Status | Probe | Notes |
|
|
222
|
+
| ------------------------------------------------------------------------------------------ | :----: | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
223
|
+
| Generic functions | ✅ | [syntax-generic-functions.ts](conformance/syntax-generic-functions.ts) | Type parameters → Go generics; call sites infer from arguments |
|
|
224
|
+
| Generic classes | ✅ | [syntax-generic-classes.ts](conformance/syntax-generic-classes.ts) | Type parameters via Go generics |
|
|
225
|
+
| 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 |
|
|
226
|
+
| Default type parameters (`<T = D>`) | ✅ | [syntax-generic-defaults.ts](conformance/syntax-generic-defaults.ts) | Defaults are erased; Go infers from arguments |
|
|
227
|
+
| Generic interfaces / type aliases | ✅ | [syntax-generic-interfaces.ts](conformance/syntax-generic-interfaces.ts) | Go generic structs; literals instantiate them (`Box[float64]{…}`) |
|
|
228
|
+
| `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 |
|
|
229
|
+
| 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]` |
|
|
230
|
+
| 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 |
|
|
201
231
|
|
|
202
232
|
## Enums
|
|
203
233
|
|
|
@@ -211,97 +241,118 @@ declared there fails the type check before it reaches the transpiler. The
|
|
|
211
241
|
|
|
212
242
|
## Type-system features
|
|
213
243
|
|
|
214
|
-
| Feature
|
|
215
|
-
|
|
|
216
|
-
| Type aliases
|
|
217
|
-
| Union types
|
|
218
|
-
| Type guards (`is`)
|
|
219
|
-
| `as` assertions
|
|
220
|
-
| Self-host contextual typing
|
|
221
|
-
| Decorators (`@`)
|
|
222
|
-
| Field / accessor / parameter decorators, `context.addInitializer`, `Symbol.metadata`
|
|
223
|
-
| Namespaces / `module` blocks
|
|
224
|
-
| `override` modifier
|
|
225
|
-
| `readonly` modifier (properties, `readonly T[]`)
|
|
226
|
-
| `satisfies` operator
|
|
227
|
-
| `keyof` / mapped types
|
|
228
|
-
| Conditional types
|
|
229
|
-
| `infer` types
|
|
230
|
-
| `import type` / `export type`
|
|
231
|
-
| Intersection types (`A & B`)
|
|
232
|
-
| Literal types (`'a' \| 'b'`)
|
|
233
|
-
| Tuple optional / rest / labeled elements
|
|
234
|
-
| Indexed access types (`T['k']`)
|
|
235
|
-
| Type-level `typeof` (`typeof obj`)
|
|
236
|
-
| Template literal types
|
|
237
|
-
| Utility types (`Partial`, `Pick`, `Omit`, …)
|
|
238
|
-
| Assertion functions (`asserts x is T`)
|
|
239
|
-
| Callable / construct signatures (`type F = { (): void }`)
|
|
240
|
-
| JSX / `.tsx` syntax
|
|
241
|
-
| Ambient declarations (`declare`, `.d.ts`, `x!: T`)
|
|
242
|
-
| `export =` / `import x = require()`
|
|
243
|
-
| Recursive types (`type Tree = { children: Tree[] }`)
|
|
244
|
+
| Feature | Status | Probe | Notes |
|
|
245
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
246
|
+
| Type aliases | ✅ | [syntax-type-aliases.ts](conformance/syntax-type-aliases.ts) | `type P = { x: number }` → Go struct; alias-of-alias |
|
|
247
|
+
| Union types | ✅ | [syntax-union-types.ts](conformance/syntax-union-types.ts) | Narrowed via `typeof` checks |
|
|
248
|
+
| Type guards (`is`) | ✅ | [syntax-type-guards.ts](conformance/syntax-type-guards.ts) | `p is T` → Go `bool`; `in` checks struct fields at runtime |
|
|
249
|
+
| `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` |
|
|
250
|
+
| Self-host contextual typing | ✅ | [syntax-selfhost-context.ts](conformance/syntax-selfhost-context.ts) | Object/array literals typed from context, `Record` literals, `in`, `any` params |
|
|
251
|
+
| Decorators (`@`) | ✅ | [syntax-decorators.ts](conformance/syntax-decorators.ts) | Standard method & class decorators, applied in source order; `this` is the receiver |
|
|
252
|
+
| 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) |
|
|
253
|
+
| Namespaces / `module` blocks | ✅ | [syntax-namespaces.ts](conformance/syntax-namespaces.ts) | Flattened to prefixed declarations (`N.f` → `N_f`), nested and in types |
|
|
254
|
+
| `override` modifier | ✅ | [syntax-override.ts](conformance/syntax-override.ts) | Erased |
|
|
255
|
+
| `readonly` modifier (properties, `readonly T[]`) | ✅ | [syntax-readonly.ts](conformance/syntax-readonly.ts) | Erased (`readonly T[]` → `[]T`) |
|
|
256
|
+
| `satisfies` operator | ✅ | [syntax-satisfies.ts](conformance/syntax-satisfies.ts) | Checked by tsc, erased; the type guides literals |
|
|
257
|
+
| `keyof` / mapped types | ✅ | [syntax-keyof-mapped-types.ts](conformance/syntax-keyof-mapped-types.ts) | `keyof` → `string`; mapped types → structs (literal keys) or maps |
|
|
258
|
+
| Conditional types | ✅ | [syntax-conditional-types.ts](conformance/syntax-conditional-types.ts) | Resolved to their branch's Go type |
|
|
259
|
+
| `infer` types | ✅ | [syntax-infer-types.ts](conformance/syntax-infer-types.ts) | Resolved to their branch's Go type |
|
|
260
|
+
| `import type` / `export type` | ✅ | [syntax-import-type.ts](conformance/syntax-import-type.ts) | Type-only imports are erased |
|
|
261
|
+
| Intersection types (`A & B`) | ✅ | [syntax-intersection-types.ts](conformance/syntax-intersection-types.ts) | Object types merge into one struct |
|
|
262
|
+
| Literal types (`'a' \| 'b'`) | ✅ | [syntax-literal-types.ts](conformance/syntax-literal-types.ts) | Erased; string/number/boolean literals map to their base Go types |
|
|
263
|
+
| Tuple optional / rest / labeled elements | ✅ | [syntax-tuple-elements.ts](conformance/syntax-tuple-elements.ts) | Tuples are slices |
|
|
264
|
+
| Indexed access types (`T['k']`) | ✅ | [syntax-indexed-access-types.ts](conformance/syntax-indexed-access-types.ts) | `T['k']` resolves to the member type |
|
|
265
|
+
| Type-level `typeof` (`typeof obj`) | ✅ | [syntax-type-typeof.ts](conformance/syntax-type-typeof.ts) | The variable's Go type |
|
|
266
|
+
| Template literal types | ✅ | [syntax-template-literal-types.ts](conformance/syntax-template-literal-types.ts) | Template literal types → `string` |
|
|
267
|
+
| Utility types (`Partial`, `Pick`, `Omit`, …) | ✅ | [syntax-utility-types.ts](conformance/syntax-utility-types.ts) | `Partial` / `Required` / `Readonly` / `Pick` / `Omit` / `NonNullable` → the base type |
|
|
268
|
+
| Assertion functions (`asserts x is T`) | ✅ | [syntax-assertion-functions.ts](conformance/syntax-assertion-functions.ts) | No return value |
|
|
269
|
+
| 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 |
|
|
270
|
+
| JSX / `.tsx` syntax | ✅ | [syntax-jsx.tsx](conformance/syntax-jsx.tsx) | Renders to HTML strings (text escaped); components are calls with props |
|
|
271
|
+
| 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 |
|
|
272
|
+
| `export =` / `import x = require()` | ✅ | [syntax-export-equals.ts](conformance/syntax-export-equals.ts) | `import x = require()` is a namespace import |
|
|
273
|
+
| Recursive types (`type Tree = { children: Tree[] }`) | ✅ | — | Self-referencing structs |
|
|
274
|
+
| `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 |
|
|
275
|
+
| 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 |
|
|
276
|
+
| `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 |
|
|
277
|
+
| 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 |
|
|
278
|
+
| 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 |
|
|
279
|
+
| 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 |
|
|
244
280
|
|
|
245
281
|
## Modules & imports
|
|
246
282
|
|
|
247
|
-
| Feature
|
|
248
|
-
|
|
|
249
|
-
| Named imports
|
|
250
|
-
| Import renaming (`import { x as y }`)
|
|
251
|
-
| Named exports (`export const` / `export function`)
|
|
252
|
-
| Default imports
|
|
253
|
-
| Namespace imports
|
|
254
|
-
| Local file imports
|
|
255
|
-
| Default export
|
|
256
|
-
| Node.js built-in imports
|
|
257
|
-
| Go package imports
|
|
258
|
-
| npm package imports
|
|
259
|
-
| Re-exports (`export { x } from`, `export *`)
|
|
260
|
-
| Dynamic `import()`
|
|
261
|
-
| Side-effect imports (`import './mod'`)
|
|
262
|
-
| `import.meta.url`
|
|
263
|
-
| JSON modules (`import data from './x.json' with { type: 'json' }`)
|
|
283
|
+
| Feature | Status | Probe | Notes |
|
|
284
|
+
| ---------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
285
|
+
| Named imports | ✅ | [syntax-import-go.ts](conformance/syntax-import-go.ts) | `import { x } from './file'` |
|
|
286
|
+
| Import renaming (`import { x as y }`) | ✅ | [syntax-import-renaming.ts](conformance/syntax-import-renaming.ts) | Local file imports |
|
|
287
|
+
| 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` |
|
|
288
|
+
| Default imports | ✅ | [syntax-import-go.ts](conformance/syntax-import-go.ts) | `import x from 'pkg'` — namespace stripped in output |
|
|
289
|
+
| Namespace imports | ✅ | [syntax-import-go.ts](conformance/syntax-import-go.ts) | `import * as x from 'pkg'` |
|
|
290
|
+
| 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)) |
|
|
291
|
+
| Default export | ✅ | [syntax-default-export.ts](conformance/syntax-default-export.ts) | `export default function` |
|
|
292
|
+
| 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)) |
|
|
293
|
+
| Go package imports | ✅ | [syntax-import-go.ts](conformance/syntax-import-go.ts) | `import { x } from 'go:pkg'` |
|
|
294
|
+
| npm package imports | ✅ | [syntax-import-npm.ts](conformance/syntax-import-npm.ts) | `import { x } from 'pkg'` mapped to Go module imports |
|
|
295
|
+
| Re-exports (`export { x } from`, `export *`) | ✅ | [syntax-re-exports.ts](conformance/syntax-re-exports.ts) | Re-exported files are included (one Go package) |
|
|
296
|
+
| Dynamic `import()` | ✅ | [syntax-dynamic-import.ts](conformance/syntax-dynamic-import.ts) | `const m = await import('./x')` is a namespace import |
|
|
297
|
+
| 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()` |
|
|
298
|
+
| `import.meta.url` | ✅ | [syntax-import-meta.ts](conformance/syntax-import-meta.ts) | The `file://` URL of the running program (`os.Executable` → `pathToFileURL`) |
|
|
299
|
+
| 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 |
|
|
300
|
+
| 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 |
|
|
301
|
+
| `Ns.T` of a namespace declared in another module | ✅ | [syntax-namespace-types-import.ts](conformance/syntax-namespace-types-import.ts) | `import type { Ns }` included |
|
|
264
302
|
|
|
265
303
|
## Async & timing
|
|
266
304
|
|
|
267
|
-
| Feature
|
|
268
|
-
|
|
|
269
|
-
| `async` / `await`
|
|
270
|
-
| Async arrow callbacks (`emitter.on('x', async () => { await … })`, `test('t', async () => …)`)
|
|
271
|
-
| `Promise` constructor / `.then`
|
|
272
|
-
| `Promise.all`
|
|
273
|
-
| `Promise.resolve`
|
|
274
|
-
| `Promise.reject` / `.catch` / `.finally`
|
|
275
|
-
| `Promise.race` / `allSettled` / `any`
|
|
276
|
-
| `clearTimeout`
|
|
277
|
-
| `setInterval` / `clearInterval`
|
|
278
|
-
| `queueMicrotask`
|
|
279
|
-
| `setTimeout`
|
|
280
|
-
| `resolve` / `reject` passed as values
|
|
281
|
-
| Async class methods (instance, static, inherited, unannotated); `return otherPromise()`
|
|
282
|
-
| `Promise.withResolvers` / `Promise.try`
|
|
283
|
-
| Async arrows kept as values (`const f = async () => …`)
|
|
305
|
+
| Feature | Status | Probe | Notes |
|
|
306
|
+
| -------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
307
|
+
| `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 |
|
|
308
|
+
| 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 |
|
|
309
|
+
| `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 |
|
|
310
|
+
| `Promise.all` | ✅ | [syntax-promise-all.ts](conformance/syntax-promise-all.ts) | `TnPromiseAll` drains every promise channel into a slice |
|
|
311
|
+
| `Promise.resolve` | ✅ | [lib-promise-resolve.ts](conformance/lib-promise-resolve.ts) | Buffered channel holding the value |
|
|
312
|
+
| `Promise.reject` / `.catch` / `.finally` | ✅ | [lib-promise-catch.ts](conformance/lib-promise-catch.ts) | Rejected promises are closed channels with a reason; `await` rethrows |
|
|
313
|
+
| `Promise.race` / `allSettled` / `any` | ✅ | [lib-promise-combinators.ts](conformance/lib-promise-combinators.ts) | Goroutine per promise; first settled / all settled / first fulfilled |
|
|
314
|
+
| `clearTimeout` | ✅ | [lib-timers.ts](conformance/lib-timers.ts) | `TnClearTimeout` stops the timer |
|
|
315
|
+
| `setInterval` / `clearInterval` | ✅ | [lib-set-interval.ts](conformance/lib-set-interval.ts) | `time.Ticker` posting to the event loop; the process lives until cleared |
|
|
316
|
+
| `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) |
|
|
317
|
+
| `setTimeout` | ✅ | [lib-set-timeout.ts](conformance/lib-set-timeout.ts) | `time.AfterFunc` posting the callback to the event loop, which keeps the process alive |
|
|
318
|
+
| `resolve` / `reject` passed as values | ✅ | [lib-node-async-hooks.ts](conformance/lib-node-async-hooks.ts) | `new Promise((resolve) => setTimeout(resolve, ms))` |
|
|
319
|
+
| 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 |
|
|
320
|
+
| `Promise.withResolvers` / `Promise.try` | ✅ | [lib-promise-extras.ts](conformance/lib-promise-extras.ts) | |
|
|
321
|
+
| 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) |
|
|
322
|
+
| `.then` on a `Promise.resolve(v)` held in a variable | ❌ | — | Go build error (`chan T` has no `then`); `await` it, or build it with `new Promise` |
|
|
323
|
+
| 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 |
|
|
284
324
|
|
|
285
325
|
## Semantics (JS behaviour preserved)
|
|
286
326
|
|
|
287
|
-
| Feature
|
|
288
|
-
|
|
|
289
|
-
| Array reference semantics
|
|
290
|
-
| `any[]` arrays mutated through a parameter (`function f(a: any[]) { a.push(x) }`)
|
|
291
|
-
|
|
|
292
|
-
| Object
|
|
293
|
-
| Object
|
|
294
|
-
|
|
|
295
|
-
|
|
|
296
|
-
|
|
|
297
|
-
|
|
|
298
|
-
|
|
|
299
|
-
| `
|
|
300
|
-
|
|
|
301
|
-
|
|
|
302
|
-
|
|
|
303
|
-
|
|
|
304
|
-
|
|
|
327
|
+
| Feature | Status | Probe | Notes |
|
|
328
|
+
| --------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
329
|
+
| Array reference semantics | ✅ | [semantics-array-reference.ts](conformance/semantics-array-reference.ts) | Array variables hold `*[]T` so aliases share the slice header |
|
|
330
|
+
| `any[]` arrays mutated through a parameter (`function f(a: any[]) { a.push(x) }`) | ❌ | — | `any[]` arrays are plain `[]interface{}`, not shared references: a `push` inside the callee is lost to the caller (typed arrays share) |
|
|
331
|
+
| Arrays held in a `Map` / `Record` / array, mutated in place (`m.get(k)!.push(x)`) | ❌ | — | Containers hold `[]T` by value: a `push` on the element doesn't compile, and a `push` through a local read of it (`const a = m.get(k)!`) is lost. Read, modify, then `set` it back |
|
|
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)`) | ❌ | — | The variable holds its own slice: pushes and splices through it do not reach the field |
|
|
349
|
+
| An array read from an `any` object into a variable, then pushed to | ❌ | — | `o.list.push(x)` reaches the object; `const l = o.list; l.push(x)` does not |
|
|
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 }`) | ❌ | — | It becomes a Go map, whose keys come out sorted (`a, b`); a typed (or inferred) literal keeps its order |
|
|
355
|
+
| `arr?.length` on an absent array | ❌ | — | Reads `0` instead of `undefined`; test `arr` itself |
|
|
305
356
|
|
|
306
357
|
## Sample apps
|
|
307
358
|
|
|
@@ -312,6 +363,23 @@ End-to-end programs that combine many features the way real code does (they run
|
|
|
312
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` |
|
|
313
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 |
|
|
314
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 |
|
|
315
383
|
|
|
316
384
|
## Standard library
|
|
317
385
|
|
|
@@ -319,6 +387,13 @@ Every standard-library API TypeNative ports, split by module. Per
|
|
|
319
387
|
[types/typenative-npm.d.ts](types/typenative-npm.d.ts) (`node:*`) and
|
|
320
388
|
[types/typenative-go.d.ts](types/typenative-go.d.ts) (`go:*`).
|
|
321
389
|
|
|
390
|
+
The reference runtime is Node 26 (V8 14.6). Notes that start with **Node 25** or
|
|
391
|
+
**Node 26** mark APIs added, changed or removed since Node 24, the previous
|
|
392
|
+
baseline, and name the release that changed them. Experimental modules that
|
|
393
|
+
still need a flag in Node 26 (`node:vfs`, `node:bench`, `node:dtls`,
|
|
394
|
+
`node:stream/iter`, the global `Worker`) aren't tracked until they ship
|
|
395
|
+
unflagged.
|
|
396
|
+
|
|
322
397
|
### `console`
|
|
323
398
|
|
|
324
399
|
| API | Status | Probe | Notes |
|
|
@@ -359,44 +434,53 @@ Every standard-library API TypeNative ports, split by module. Per
|
|
|
359
434
|
|
|
360
435
|
### `Object`
|
|
361
436
|
|
|
362
|
-
| API
|
|
363
|
-
|
|
|
364
|
-
| `Object.keys` / `values` / `entries`
|
|
365
|
-
| `Object.keys` / `values` / `entries`, `for...in` on typed objects (interfaces, object literals, class instances)
|
|
366
|
-
| `Object.assign`
|
|
367
|
-
| `Object.freeze` / `seal` / `preventExtensions` / `isFrozen` / `isSealed` / `isExtensible`
|
|
368
|
-
| `Object.fromEntries`
|
|
369
|
-
| `Object.hasOwn` / `defineProperty` / `getOwnPropertyNames`
|
|
370
|
-
| `Object.hasOwn` / `defineProperty` with a non-literal key on a typed object
|
|
371
|
-
| `Object.is`
|
|
372
|
-
| `Object.groupBy` / `Map.groupBy`
|
|
373
|
-
| `Object.create
|
|
437
|
+
| API | Status | Probe | Notes |
|
|
438
|
+
| ------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
439
|
+
| `Object.keys` / `values` / `entries` | ✅ | [lib-object-helpers.ts](conformance/lib-object-helpers.ts) | Map key/value iteration helpers; typed results for maps and records |
|
|
440
|
+
| `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 |
|
|
441
|
+
| `Object.assign` | ✅ | [lib-object-assign.ts](conformance/lib-object-assign.ts) | Sources (structs, maps, dynamic objects) copied into an ordered map |
|
|
442
|
+
| `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) |
|
|
443
|
+
| `Object.fromEntries` | ✅ | [lib-object-from-entries.ts](conformance/lib-object-from-entries.ts) | `TnFromEntries` → dynamic object |
|
|
444
|
+
| `Object.hasOwn` / `defineProperty` / `getOwnPropertyNames` | ✅ | [lib-object-own.ts](conformance/lib-object-own.ts) | Maps, dynamic objects and typed objects (literal keys); `{ value }` descriptors |
|
|
445
|
+
| `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) |
|
|
446
|
+
| `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` |
|
|
447
|
+
| `Object.groupBy` / `Map.groupBy` | ✅ | [lib-group-by.ts](conformance/lib-group-by.ts) | Groups in first-seen key order |
|
|
448
|
+
| `Object.create(null)` | ✅ | [lib-object-create-null.ts](conformance/lib-object-create-null.ts) | An empty dynamic object (the prototype-less dictionary idiom) |
|
|
449
|
+
| `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 |
|
|
450
|
+
| `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 |
|
|
451
|
+
| 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 |
|
|
452
|
+
| `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) |
|
|
453
|
+
| 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 |
|
|
374
454
|
|
|
375
455
|
### `String`
|
|
376
456
|
|
|
377
|
-
| API | Status | Probe | Notes
|
|
378
|
-
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------- |
|
|
379
|
-
| Template literals | ✅ | [syntax-template-literals.ts](conformance/syntax-template-literals.ts) | Backtick strings with `${expr}` interpolation
|
|
380
|
-
| Tagged templates | ✅ | [syntax-tagged-templates.ts](conformance/syntax-tagged-templates.ts) | Desugared to `tag([...strings], ...values)`
|
|
381
|
-
| `toUpperCase` / `toLowerCase` | ✅ | [lib-string-basics.ts](conformance/lib-string-basics.ts) | Via `strings` package
|
|
382
|
-
| `trim` / `trimStart` / `trimEnd` | ✅ | [lib-string-basics.ts](conformance/lib-string-basics.ts) | Via `strings` package
|
|
383
|
-
| `split` / `join` | ✅ | [lib-string-split-join.ts](conformance/lib-string-split-join.ts) | Via `strings` package
|
|
384
|
-
| `includes` / `startsWith` / `endsWith` / `indexOf` (with `fromIndex`) | ✅ | [lib-string-search.ts](conformance/lib-string-search.ts) | Via `strings` package
|
|
385
|
-
| `replace` / `replaceAll` (string pattern) | ✅ | [lib-string-replace.ts](conformance/lib-string-replace.ts) | Via `strings` package
|
|
386
|
-
| `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
|
|
387
|
-
| `charAt` / `substring` / `slice` | ✅ | [lib-string-slice.ts](conformance/lib-string-slice.ts) | Direct Go string indexing/slicing
|
|
388
|
-
| `charCodeAt` / `String.fromCharCode` | ✅ | [lib-string-char-codes.ts](conformance/lib-string-char-codes.ts) | `charCodeAt` reads the byte; `String.fromCharCode` → `string(rune(n))`
|
|
389
|
-
| `concat` / `repeat` | ✅ | [lib-string-pad-repeat.ts](conformance/lib-string-pad-repeat.ts) | Concatenation and `strings.Repeat`
|
|
390
|
-
| `padStart` / `padEnd` | ✅ | [lib-string-pad-repeat.ts](conformance/lib-string-pad-repeat.ts) | Via `strings.Repeat`
|
|
391
|
-
| `localeCompare` | ✅ | [lib-string-compare.ts](conformance/lib-string-compare.ts) | `strings.Compare` → -1/0/1: code-unit order, not locale-aware
|
|
392
|
-
| `match` / `matchAll` / `search` | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Via `regexp` package (`String.match` with groups)
|
|
393
|
-
| `at` (negative indices) | ✅ | [lib-array-at.ts](conformance/lib-array-at.ts) | Supports negative indices
|
|
394
|
-
| Unicode length / iteration | ✅ | [lib-string-unicode.ts](conformance/lib-string-unicode.ts) | `.length` counts runes; `[...str]` spreads runes
|
|
395
|
-
| `String.raw` | ✅ | [lib-string-raw.ts](conformance/lib-string-raw.ts) | Raw template text with values interpolated
|
|
396
|
-
| `normalize` | ✅ | [lib-string-normalize.ts](conformance/lib-string-normalize.ts) | `golang.org/x/text/unicode/norm`, copied from GOROOT's vendor tree (offline)
|
|
397
|
-
| `split(sep, limit)` / `lastIndexOf(s, fromIndex)` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) |
|
|
398
|
-
| `localeCompare(s, locales, options)` | ❌ | — | Locales / options are not declared; the comparison is by code unit
|
|
399
|
-
| `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 ignore the locale
|
|
457
|
+
| API | Status | Probe | Notes |
|
|
458
|
+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
459
|
+
| Template literals | ✅ | [syntax-template-literals.ts](conformance/syntax-template-literals.ts) | Backtick strings with `${expr}` interpolation |
|
|
460
|
+
| Tagged templates | ✅ | [syntax-tagged-templates.ts](conformance/syntax-tagged-templates.ts) | Desugared to `tag([...strings], ...values)` |
|
|
461
|
+
| `toUpperCase` / `toLowerCase` | ✅ | [lib-string-basics.ts](conformance/lib-string-basics.ts) | Via `strings` package |
|
|
462
|
+
| `trim` / `trimStart` / `trimEnd` | ✅ | [lib-string-basics.ts](conformance/lib-string-basics.ts) | Via `strings` package |
|
|
463
|
+
| `split` / `join` | ✅ | [lib-string-split-join.ts](conformance/lib-string-split-join.ts) | Via `strings` package |
|
|
464
|
+
| `includes` / `startsWith` / `endsWith` / `indexOf` (with `fromIndex`) | ✅ | [lib-string-search.ts](conformance/lib-string-search.ts) | Via `strings` package |
|
|
465
|
+
| `replace` / `replaceAll` (string pattern) | ✅ | [lib-string-replace.ts](conformance/lib-string-replace.ts) | Via `strings` package |
|
|
466
|
+
| `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 |
|
|
467
|
+
| `charAt` / `substring` / `slice` | ✅ | [lib-string-slice.ts](conformance/lib-string-slice.ts) | Direct Go string indexing/slicing |
|
|
468
|
+
| `charCodeAt` / `String.fromCharCode` | ✅ | [lib-string-char-codes.ts](conformance/lib-string-char-codes.ts) | `charCodeAt` reads the byte; `String.fromCharCode` → `string(rune(n))` |
|
|
469
|
+
| `concat` / `repeat` | ✅ | [lib-string-pad-repeat.ts](conformance/lib-string-pad-repeat.ts) | Concatenation and `strings.Repeat` |
|
|
470
|
+
| `padStart` / `padEnd` | ✅ | [lib-string-pad-repeat.ts](conformance/lib-string-pad-repeat.ts) | Via `strings.Repeat` |
|
|
471
|
+
| `localeCompare` | ✅ | [lib-string-compare.ts](conformance/lib-string-compare.ts) | `strings.Compare` → -1/0/1: code-unit order, not locale-aware |
|
|
472
|
+
| `match` / `matchAll` / `search` | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Via `regexp` package (`String.match` with groups) |
|
|
473
|
+
| `at` (negative indices) | ✅ | [lib-array-at.ts](conformance/lib-array-at.ts) | Supports negative indices |
|
|
474
|
+
| Unicode length / iteration | ✅ | [lib-string-unicode.ts](conformance/lib-string-unicode.ts) | `.length` counts runes; `[...str]` spreads runes |
|
|
475
|
+
| `String.raw` | ✅ | [lib-string-raw.ts](conformance/lib-string-raw.ts) | Raw template text with values interpolated |
|
|
476
|
+
| `normalize` | ✅ | [lib-string-normalize.ts](conformance/lib-string-normalize.ts) | `golang.org/x/text/unicode/norm`, copied from GOROOT's vendor tree (offline) |
|
|
477
|
+
| `split(sep, limit)` / `lastIndexOf(s, fromIndex)` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | |
|
|
478
|
+
| `localeCompare(s, locales, options)` | ❌ | — | Locales / options are not declared; the comparison is by code unit |
|
|
479
|
+
| `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 ignore the locale |
|
|
480
|
+
| 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) |
|
|
481
|
+
| `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) | |
|
|
482
|
+
| `toUpperCase` / `toLowerCase` as JS maps case | ✅ | [lib-string-case-mapping.ts](conformance/lib-string-case-mapping.ts) | `ß` → `SS`, `fi` → `FI`, `İ` → `i̇`, `ẞ` → `ß`, final `ς` |
|
|
483
|
+
| `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 |
|
|
400
484
|
|
|
401
485
|
### `Array`
|
|
402
486
|
|
|
@@ -431,33 +515,38 @@ Every standard-library API TypeNative ports, split by module. Per
|
|
|
431
515
|
| `Array.of` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | |
|
|
432
516
|
| 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 |
|
|
433
517
|
| `Array.fromAsync` | ❌ | — | Not declared |
|
|
518
|
+
| `Iterator.concat(...iterables)` | ❌ | — | **Node 26** (ES2026 iterator sequencing). Not declared; `Iterator.from` takes only arrays and generators today |
|
|
434
519
|
| `[...map.keys()]` / `[...map.values()]` | ✅ | [lib-group-by.ts](conformance/lib-group-by.ts) | |
|
|
520
|
+
| `anyArray.concat([…])` with an array of another element type (`xs.concat(['x'])` on `any[]`) | ❌ | — | Go build error; spread instead (`[...xs, 'x']`) |
|
|
435
521
|
|
|
436
522
|
### `Map` / `Set`
|
|
437
523
|
|
|
438
|
-
| API
|
|
439
|
-
|
|
|
440
|
-
| `Map` (`set` / `get` / `has` / `delete` / `size`)
|
|
441
|
-
| `Map` iteration (`for...of`, destructuring)
|
|
442
|
-
| `Set` (`add` / `has` / `delete` / `size`)
|
|
443
|
-
| `Set` iteration / spread
|
|
444
|
-
| `Map.clear` / `Set.clear`
|
|
445
|
-
| `WeakMap` / `WeakSet`
|
|
446
|
-
| Set operations (`union` / `intersection` / `difference`)
|
|
524
|
+
| API | Status | Probe | Notes |
|
|
525
|
+
| ------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
526
|
+
| `Map` (`set` / `get` / `has` / `delete` / `size`) | ✅ | [lib-map.ts](conformance/lib-map.ts) | `Map<K, V>` → Go `map[K]V`; constructor with entries |
|
|
527
|
+
| `Map` iteration (`for...of`, destructuring) | ✅ | [lib-map-iteration.ts](conformance/lib-map-iteration.ts) | Key/value iteration, `Object.entries()` unwrapping |
|
|
528
|
+
| `Set` (`add` / `has` / `delete` / `size`) | ✅ | [lib-set.ts](conformance/lib-set.ts) | `Set<T>` → Go `map[T]struct{}`; constructor with values |
|
|
529
|
+
| `Set` iteration / spread | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | `for...of`, `[...set]` |
|
|
530
|
+
| `Map.clear` / `Set.clear` | ✅ | [lib-map-clear.ts](conformance/lib-map-clear.ts) | `TnMap.Clear()` |
|
|
531
|
+
| `WeakMap` / `WeakSet` | ✅ | [lib-weak-collections.ts](conformance/lib-weak-collections.ts) | Same as `Map` / `Set` (weakness is not observable) |
|
|
532
|
+
| Set operations (`union` / `intersection` / `difference`) | ✅ | [lib-set-operations.ts](conformance/lib-set-operations.ts) | Plus `symmetricDifference` / `isSubsetOf` / `isSupersetOf` / `isDisjointFrom` |
|
|
533
|
+
| `Map` / `WeakMap` `getOrInsert(key, value)` / `getOrInsertComputed(key, fn)` | ❌ | — | **Node 26** (ES2026 upsert). Not declared; one lookup, then a store when the key is missing |
|
|
534
|
+
| `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 |
|
|
447
535
|
|
|
448
536
|
### `Number`
|
|
449
537
|
|
|
450
|
-
| API | Status | Probe | Notes
|
|
451
|
-
| -------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------- |
|
|
452
|
-
| `toString` (incl. radix) | ✅ | [lib-number-format.ts](conformance/lib-number-format.ts) | Universal `toString()` via `fmt.Sprintf` for any type
|
|
453
|
-
| `toFixed` | ✅ | [lib-number-format.ts](conformance/lib-number-format.ts) | `n.toFixed(2)` via `strconv.FormatFloat`
|
|
454
|
-
| `parseInt` / `parseFloat` / `Number()` | ✅ | [lib-number-parse.ts](conformance/lib-number-parse.ts) | Mapped to Go's `strconv` package
|
|
455
|
-
| `Number.isInteger` / `isNaN` / `MAX_SAFE_INTEGER` | ✅ | [lib-number-checks.ts](conformance/lib-number-checks.ts) | Number predicates and constants
|
|
456
|
-
| `Number.MIN_SAFE_INTEGER` / `MAX_VALUE` | ✅ | — |
|
|
457
|
-
| `Number.EPSILON` / `isFinite` / `toPrecision` | ✅ | [lib-number-misc.ts](conformance/lib-number-misc.ts) | `toPrecision` → `strconv.FormatFloat(x, 'g', n, 64)`
|
|
458
|
-
| `String()` / `Boolean()` conversions | ✅ | [lib-conversions.ts](conformance/lib-conversions.ts) | JS formatting / truthiness
|
|
459
|
-
| `toExponential` / `Number.isSafeInteger` / `parseInt` / `parseFloat` / `MIN_VALUE` / `NEGATIVE_INFINITY` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) |
|
|
460
|
-
| Number `toLocaleString` | ❌ | — | Needs `Intl`
|
|
538
|
+
| API | Status | Probe | Notes |
|
|
539
|
+
| -------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
540
|
+
| `toString` (incl. radix) | ✅ | [lib-number-format.ts](conformance/lib-number-format.ts) | Universal `toString()` via `fmt.Sprintf` for any type |
|
|
541
|
+
| `toFixed` | ✅ | [lib-number-format.ts](conformance/lib-number-format.ts) | `n.toFixed(2)` via `strconv.FormatFloat` |
|
|
542
|
+
| `parseInt` / `parseFloat` / `Number()` | ✅ | [lib-number-parse.ts](conformance/lib-number-parse.ts) | Mapped to Go's `strconv` package |
|
|
543
|
+
| `Number.isInteger` / `isNaN` / `MAX_SAFE_INTEGER` | ✅ | [lib-number-checks.ts](conformance/lib-number-checks.ts) | Number predicates and constants |
|
|
544
|
+
| `Number.MIN_SAFE_INTEGER` / `MAX_VALUE` | ✅ | — | |
|
|
545
|
+
| `Number.EPSILON` / `isFinite` / `toPrecision` | ✅ | [lib-number-misc.ts](conformance/lib-number-misc.ts) | `toPrecision` → `strconv.FormatFloat(x, 'g', n, 64)` |
|
|
546
|
+
| `String()` / `Boolean()` conversions | ✅ | [lib-conversions.ts](conformance/lib-conversions.ts) | JS formatting / truthiness |
|
|
547
|
+
| `toExponential` / `Number.isSafeInteger` / `parseInt` / `parseFloat` / `MIN_VALUE` / `NEGATIVE_INFINITY` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | |
|
|
548
|
+
| Number `toLocaleString` | ❌ | — | Needs `Intl` |
|
|
549
|
+
| `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) |
|
|
461
550
|
|
|
462
551
|
### `Date`
|
|
463
552
|
|
|
@@ -475,22 +564,30 @@ Every standard-library API TypeNative ports, split by module. Per
|
|
|
475
564
|
|
|
476
565
|
### `RegExp`
|
|
477
566
|
|
|
478
|
-
| API
|
|
479
|
-
|
|
|
480
|
-
| Regex literals
|
|
481
|
-
| `new RegExp()`
|
|
482
|
-
| `test()`
|
|
483
|
-
| `exec()` (groups)
|
|
484
|
-
| Flags (`i`, `m`)
|
|
485
|
-
| Backreferences
|
|
486
|
-
| Named groups
|
|
487
|
-
| Global `exec` loop (`/g` + `lastIndex`)
|
|
488
|
-
| Lookbehind
|
|
489
|
-
| Remaining flags (`s` / `u` / `y`) & `source` / `flags`
|
|
490
|
-
| `split` with RegExp
|
|
491
|
-
| Match `.index` (`exec` / `match` / `matchAll`), `match` with `/g`
|
|
492
|
-
| Unicode property escapes (`\p{L}`) with `u`
|
|
493
|
-
|
|
|
567
|
+
| API | Status | Probe | Notes |
|
|
568
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
569
|
+
| Regex literals | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | `/pattern/flags` run on the regex VM, compiled once per pattern and flags |
|
|
570
|
+
| `new RegExp()` | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | Constructor with optional flags |
|
|
571
|
+
| `test()` | ✅ | [lib-regex-test.ts](conformance/lib-regex-test.ts) | Matches without building the groups |
|
|
572
|
+
| `exec()` (groups) | ✅ | [lib-regex-groups.ts](conformance/lib-regex-groups.ts) | A match array; a group that took no part is `undefined` |
|
|
573
|
+
| Flags (`i`, `m`) | ✅ | [lib-regex-flags.ts](conformance/lib-regex-flags.ts) | Case-insensitive, multiline |
|
|
574
|
+
| Backreferences | ✅ | [lib-regex-backreference.ts](conformance/lib-regex-backreference.ts) | By number and by name, on the regex VM |
|
|
575
|
+
| Named groups | ✅ | [lib-regex-named-groups.ts](conformance/lib-regex-named-groups.ts) | `(?<name>` → `(?P<name>`; `exec` returns a match with `.groups` |
|
|
576
|
+
| 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 |
|
|
577
|
+
| Lookbehind | ✅ | [lib-regex-lookbehind.ts](conformance/lib-regex-lookbehind.ts) | Lookaround runs on the regex VM |
|
|
578
|
+
| 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 |
|
|
579
|
+
| `split` with RegExp | ✅ | [lib-regex-split.ts](conformance/lib-regex-split.ts) | JS semantics: captures are included, `limit` counts items |
|
|
580
|
+
| 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 |
|
|
581
|
+
| Unicode property escapes (`\p{L}`) with `u` | ✅ | — | Only with `u` or `v`, as in JS |
|
|
582
|
+
| 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 |
|
|
583
|
+
| 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 |
|
|
584
|
+
| 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` |
|
|
585
|
+
| `d` flag `indices` / `hasIndices`; `RegExp.escape` | ❌ | — | `/x/d` compiles and matches (`flags` includes `d`); `indices`, `hasIndices` and `RegExp.escape` are not declared |
|
|
586
|
+
| `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 |
|
|
587
|
+
| 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` |
|
|
588
|
+
| 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 |
|
|
589
|
+
| 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)` |
|
|
590
|
+
| 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 |
|
|
494
591
|
|
|
495
592
|
### `Promise` / timers
|
|
496
593
|
|
|
@@ -500,40 +597,42 @@ See [Async & timing](#async--timing): `Promise` (constructor, `.then` / `.catch`
|
|
|
500
597
|
|
|
501
598
|
### Misc globals
|
|
502
599
|
|
|
503
|
-
| API | Status | Probe
|
|
504
|
-
| ----------------------------------------------------------------------------------------------------------------------------------------------------- | :----: |
|
|
505
|
-
| `assert` | ✅ | [lib-console-log.ts](conformance/lib-console-log.ts)
|
|
506
|
-
| `process.argv` / `process.platform` | ✅ | [lib-process.ts](conformance/lib-process.ts)
|
|
507
|
-
| `process.env` | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts)
|
|
508
|
-
| `process.exit` | ✅ | [lib-process-exit.ts](conformance/lib-process-exit.ts)
|
|
509
|
-
| `process.cwd()` | ✅ | [lib-process-cwd.ts](conformance/lib-process-cwd.ts)
|
|
510
|
-
| `Buffer` / `Uint8Array` / `TextEncoder` / `TextDecoder` / `atob` / `btoa` | ✅ | [lib-node-buffer-encodings.ts](conformance/lib-node-buffer-encodings.ts)
|
|
511
|
-
| `URL` / `URLSearchParams` | ✅ | [lib-node-url-class.ts](conformance/lib-node-url-class.ts)
|
|
512
|
-
| `EventTarget` / `Event` / `AbortController` / `AbortSignal` | ✅ | [lib-node-abort.ts](conformance/lib-node-abort.ts)
|
|
513
|
-
| `performance` / `setImmediate` / `crypto` | ✅ | [lib-node-perf-hooks.ts](conformance/lib-node-perf-hooks.ts)
|
|
514
|
-
| `TypeError` / `RangeError` / `SyntaxError` & co. | ✅ | [lib-node-assert.ts](conformance/lib-node-assert.ts)
|
|
515
|
-
| `Infinity` | ✅ | [lib-globals.ts](conformance/lib-globals.ts)
|
|
516
|
-
| Global `isNaN` / `isFinite` | ✅ | [lib-globals.ts](conformance/lib-globals.ts)
|
|
517
|
-
| `encodeURIComponent` / `decodeURIComponent` | ✅ | [lib-uri.ts](conformance/lib-uri.ts)
|
|
518
|
-
| `structuredClone` | ✅ | [lib-structured-clone.ts](conformance/lib-structured-clone.ts)
|
|
519
|
-
| `fetch` / `Headers` / `Request` / `Response` | ✅ | [lib-node-fetch.ts](conformance/lib-node-fetch.ts)
|
|
520
|
-
| `ReadableStream` / `WritableStream` / `TransformStream` & co., `TextEncoderStream` / `TextDecoderStream`, `CompressionStream` / `DecompressionStream` | ✅ | [lib-node-stream-web.ts](conformance/lib-node-stream-web.ts)
|
|
521
|
-
| `Blob` / `File` / `FormData` | ✅ | [lib-node-blob.ts](conformance/lib-node-blob.ts)
|
|
522
|
-
| `MessageChannel` / `MessagePort` / `BroadcastChannel` | ✅ | [lib-node-worker-threads.ts](conformance/lib-node-worker-threads.ts)
|
|
523
|
-
| `__filename` / `__dirname` | ✅ | —
|
|
524
|
-
| `globalThis` | ✅ | [lib-global-this.ts](conformance/lib-global-this.ts)
|
|
525
|
-
| `err.stack` | ✅ | [lib-error-stack.ts](conformance/lib-error-stack.ts)
|
|
526
|
-
| `AggregateError` (`errors`) | ✅ | [lib-error-stack.ts](conformance/lib-error-stack.ts)
|
|
527
|
-
| `Error.captureStackTrace` / `Error.isError` / `DOMException`
|
|
528
|
-
| `Symbol.for` / `Symbol.keyFor` / `description` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts)
|
|
529
|
-
| `[Symbol.asyncIterator]()` methods; `Symbol.toPrimitive` / `hasInstance` / `toStringTag` | ❌ | —
|
|
530
|
-
| `WeakRef` / `FinalizationRegistry` | ✅ | [lib-weak-refs.ts](conformance/lib-weak-refs.ts)
|
|
531
|
-
| `Reflect` (`ownKeys` / `has` / `get` / `set` / …) | ❌ | —
|
|
532
|
-
| `Proxy` | 🚫 | —
|
|
533
|
-
| `Intl` (`NumberFormat`, `DateTimeFormat`, `Collator`, `PluralRules`, `ListFormat`, `RelativeTimeFormat`, `Segmenter`), `toLocaleString` | ❌ | —
|
|
534
|
-
| `Temporal` | ❌ | —
|
|
535
|
-
| `WebSocket` / `navigator` / `CustomEvent` / `URLPattern` / `EventSource` / `reportError`
|
|
536
|
-
| `
|
|
600
|
+
| API | Status | Probe | Notes |
|
|
601
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
602
|
+
| `assert` | ✅ | [lib-console-log.ts](conformance/lib-console-log.ts) | Transpiled to `panic` on failure |
|
|
603
|
+
| `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) |
|
|
604
|
+
| `process.env` | ✅ | [syntax-top-level-scope.ts](conformance/syntax-top-level-scope.ts) | Environment variable access |
|
|
605
|
+
| `process.exit` | ✅ | [lib-process-exit.ts](conformance/lib-process-exit.ts) | `os.Exit`, after `process.on('exit')` listeners |
|
|
606
|
+
| `process.cwd()` | ✅ | [lib-process-cwd.ts](conformance/lib-process-cwd.ts) | `os.Getwd()` |
|
|
607
|
+
| `Buffer` / `Uint8Array` / `TextEncoder` / `TextDecoder` / `atob` / `btoa` | ✅ | [lib-node-buffer-encodings.ts](conformance/lib-node-buffer-encodings.ts) | See [node:buffer](#nodebuffer) |
|
|
608
|
+
| `URL` / `URLSearchParams` | ✅ | [lib-node-url-class.ts](conformance/lib-node-url-class.ts) | See [node:url](#nodeurl) |
|
|
609
|
+
| `EventTarget` / `Event` / `AbortController` / `AbortSignal` | ✅ | [lib-node-abort.ts](conformance/lib-node-abort.ts) | See [node:events](#nodeevents) |
|
|
610
|
+
| `performance` / `setImmediate` / `crypto` | ✅ | [lib-node-perf-hooks.ts](conformance/lib-node-perf-hooks.ts) | See [perf_hooks](#nodeperf_hooks), [timers](#nodetimers), [crypto](#nodecrypto) |
|
|
611
|
+
| `TypeError` / `RangeError` / `SyntaxError` & co. | ✅ | [lib-node-assert.ts](conformance/lib-node-assert.ts) | `TnError`s carrying their `name`; `instanceof` checks the name |
|
|
612
|
+
| `Infinity` | ✅ | [lib-globals.ts](conformance/lib-globals.ts) | `math.Inf(1)` |
|
|
613
|
+
| Global `isNaN` / `isFinite` | ✅ | [lib-globals.ts](conformance/lib-globals.ts) | `math.IsNaN` / `math.IsInf` |
|
|
614
|
+
| `encodeURIComponent` / `decodeURIComponent` | ✅ | [lib-uri.ts](conformance/lib-uri.ts) | `TnEncodeURIComponent` / `url.PathUnescape` |
|
|
615
|
+
| `structuredClone` | ✅ | [lib-structured-clone.ts](conformance/lib-structured-clone.ts) | Reflection deep copy |
|
|
616
|
+
| `fetch` / `Headers` / `Request` / `Response` | ✅ | [lib-node-fetch.ts](conformance/lib-node-fetch.ts) | See [fetch](#fetch) |
|
|
617
|
+
| `ReadableStream` / `WritableStream` / `TransformStream` & co., `TextEncoderStream` / `TextDecoderStream`, `CompressionStream` / `DecompressionStream` | ✅ | [lib-node-stream-web.ts](conformance/lib-node-stream-web.ts) | See [stream/web](#nodestreamweb) |
|
|
618
|
+
| `Blob` / `File` / `FormData` | ✅ | [lib-node-blob.ts](conformance/lib-node-blob.ts) | See [buffer](#nodebuffer) and [fetch](#fetch) |
|
|
619
|
+
| `MessageChannel` / `MessagePort` / `BroadcastChannel` | ✅ | [lib-node-worker-threads.ts](conformance/lib-node-worker-threads.ts) | See [worker_threads](#nodeworker_threads) |
|
|
620
|
+
| `__filename` / `__dirname` | ✅ | — | The running executable (a native binary has no script file) |
|
|
621
|
+
| `globalThis` | ✅ | [lib-global-this.ts](conformance/lib-global-this.ts) | `globalThis.x` is the global `x`; `(globalThis as any)` is a dynamic object |
|
|
622
|
+
| `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 |
|
|
623
|
+
| `AggregateError` (`errors`) | ✅ | [lib-error-stack.ts](conformance/lib-error-stack.ts) | |
|
|
624
|
+
| `Error.captureStackTrace` / `Error.isError` / `DOMException` / `QuotaExceededError` | ❌ | — | Not declared. **Node 26** makes `QuotaExceededError` a global `DOMException` subclass |
|
|
625
|
+
| `Symbol.for` / `Symbol.keyFor` / `description` | ✅ | [lib-builtins-statics.ts](conformance/lib-builtins-statics.ts) | A global registry by key |
|
|
626
|
+
| `[Symbol.asyncIterator]()` methods; `Symbol.toPrimitive` / `hasInstance` / `toStringTag` | ❌ | — | Only `Symbol()`, `Symbol.iterator` and `Symbol.dispose` are lowered |
|
|
627
|
+
| `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) |
|
|
628
|
+
| `Reflect` (`ownKeys` / `has` / `get` / `set` / …) | ❌ | — | Feasible over the existing dynamic property access |
|
|
629
|
+
| `Proxy` | 🚫 | — | Intercepting every property access on static Go structs; a `Proxy` limited to dynamic (`any`) objects would be feasible |
|
|
630
|
+
| `Intl` (`NumberFormat`, `DateTimeFormat`, `Collator`, `PluralRules`, `ListFormat`, `RelativeTimeFormat`, `Segmenter`), `toLocaleString` | ❌ | — | Needs locale data (vendored `golang.org/x/text`, or hand-written `en-US` first) |
|
|
631
|
+
| `Temporal` | ❌ | — | **Node 26** makes it a global with no flag (`Temporal.Now`, `PlainDate`, `ZonedDateTime`, `Instant`, `Duration`, …). Feasible on Go's `time` and tzdata |
|
|
632
|
+
| `WebSocket` / `navigator` / `CustomEvent` / `URLPattern` / `EventSource` / `reportError` / `ErrorEvent` | ❌ | — | Not declared. `ErrorEvent` is a global from **Node 25** |
|
|
633
|
+
| `localStorage` / `sessionStorage` / `Storage` (`getItem` / `setItem` / `removeItem` / `clear` / `key` / `length`) | ❌ | — | **Node 25** turns Web Storage on by default. `sessionStorage` lives in memory; `localStorage` persists to `--localstorage-file` and, from **Node 26**, is `undefined` without it |
|
|
634
|
+
| `WebAssembly` | ❌ | — | Needs a Wasm runtime: vendoring wazero (pure Go, no cgo) would provide one (see [wasi](#nodewasi)) |
|
|
635
|
+
| `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 |
|
|
537
636
|
|
|
538
637
|
### Node builtins (`node:*`)
|
|
539
638
|
|
|
@@ -559,6 +658,7 @@ async function runs synchronously until its first `await`.
|
|
|
559
658
|
| `node:dns` / `node:dns/promises` | ✅ | [dns](#nodedns) |
|
|
560
659
|
| `node:domain` | 🚫 | [domain](#nodedomain) |
|
|
561
660
|
| `node:events` (+ `EventTarget`, `AbortController`) | ✅ | [events](#nodeevents) |
|
|
661
|
+
| `node:ffi` | ❌ | [ffi](#nodeffi) |
|
|
562
662
|
| `node:fs` / `node:fs/promises` | ✅ | [fs](#nodefs) |
|
|
563
663
|
| `node:http` / `node:https` | ✅ | [http / https](#nodehttp--nodehttps) |
|
|
564
664
|
| `node:http2` | ✅ | [http2](#nodehttp2) |
|
|
@@ -580,7 +680,7 @@ async function runs synchronously until its first `await`.
|
|
|
580
680
|
| `node:string_decoder` | ✅ | [string_decoder](#nodestring_decoder) |
|
|
581
681
|
| `node:sys` | ✅ | [constants / sys](#nodeconstants--nodesys) |
|
|
582
682
|
| `node:test` | ✅ | [test](#nodetest) |
|
|
583
|
-
| `node:test/reporters` |
|
|
683
|
+
| `node:test/reporters` | ✅ | [test/reporters](#nodetestreporters) |
|
|
584
684
|
| `node:timers` / `node:timers/promises` | ✅ | [timers](#nodetimers) |
|
|
585
685
|
| `node:tls` | ✅ | [tls](#nodetls) |
|
|
586
686
|
| `node:trace_events` | 🚫 | [trace_events](#nodetrace_events) |
|
|
@@ -616,7 +716,11 @@ async function runs synchronously until its first `await`.
|
|
|
616
716
|
| `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` |
|
|
617
717
|
| 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 its own bytes (`byteOffset` 0). Out-of-range reads give `0`, not `undefined`. |
|
|
618
718
|
| `BigInt64Array` / `BigUint64Array` | ❌ | — | `DataView` already has the BigInt64 accessors |
|
|
619
|
-
| `
|
|
719
|
+
| `Uint8Array.fromBase64` / `u8.toBase64()` | ✅ | [lib-uint8array-base64.ts](conformance/lib-uint8array-base64.ts) | Standard alphabet with padding; no options (`alphabet`, `omitPadding`, `lastChunkHandling`) |
|
|
720
|
+
| `Float16Array`, resizable `ArrayBuffer` (`resize`, `transfer`), `Uint8Array` `toHex` / `fromHex` | ❌ | — | Not declared |
|
|
721
|
+
| `Uint8Array` `setFromBase64` / `setFromHex`; `toBase64` / `fromBase64` options (`alphabet`, `omitPadding`, `lastChunkHandling`) | ❌ | — | **Node 25** (V8 14.1) ships the whole ES2026 base64 / hex API |
|
|
722
|
+
| `Buffer.stringLength(input, encoding)`, `buffer.isLatin1`, `blob.textStream()`, `end` argument of `buf.indexOf` / `lastIndexOf` / `includes`, `alignment` argument of `Buffer.allocUnsafe(Slow)`, `Buffer.poolSize` | ❌ | — | **Node 26**: `end` (26.1), `textStream` (26.5), `alignment` (26.8), `stringLength` / `isLatin1` (26.11); `poolSize` now defaults to 64 KiB (26.3). `lastIndexOf` isn't declared at all |
|
|
723
|
+
| `JSON.stringify(buffer)`, `buf.toJSON()` | ✅ | [lib-buffer-json.ts](conformance/lib-buffer-json.ts) | `{"type":"Buffer","data":[…]}`, keys in that order |
|
|
620
724
|
|
|
621
725
|
#### `node:fs`
|
|
622
726
|
|
|
@@ -632,6 +736,9 @@ async function runs synchronously until its first `await`.
|
|
|
632
736
|
| `createReadStream` / `createWriteStream` | ✅ | [lib-node-fs-streams.ts](conformance/lib-node-fs-streams.ts) | `encoding`, `start` / `end`, `highWaterMark`, `flags` |
|
|
633
737
|
| `chmodSync` / `utimesSync` / `symlinkSync` / `readlinkSync` / `linkSync` | ✅ | — | Implemented, not probed (symlinks need privileges on Windows) |
|
|
634
738
|
| `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()` |
|
|
739
|
+
| 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` | ❌ | — | **Node 25**. TypeNative still declares and compiles them; they should leave the types so programs fail the type check, as they fail in Node |
|
|
740
|
+
| `openAsBlobSync` / `openAsBlob`, `statfs` / `statfsSync` (with `frsize`), the `buffer` option of `readFile`, `signal` on `stat` / `lstat` / `fstat`, `Temporal.Instant` fields on `Stats` (`atimeInstant` …), the `windowsHandle` stream option; `FileHandle` `pull` / `pullSync` / `writer` | ❌ | — | **Node 25 / 26**: `FileHandle` iteration (25.9), `frsize` and `stat` `signal` (26.1), `Instant` fields (26.2), `readFile` `buffer` (26.4), `openAsBlobSync` (26.10) |
|
|
741
|
+
| `glob` / `globSync` / `fs/promises` `glob` (`cwd`, `exclude`, `withFileTypes`, `followSymlinks`, `maxDepth`) | ❌ | — | **Node 26** adds `followSymlinks` (26.1) and `maxDepth` (26.9). `path.matchesGlob` already compiles the patterns |
|
|
635
742
|
|
|
636
743
|
#### `node:os`
|
|
637
744
|
|
|
@@ -650,9 +757,13 @@ async function runs synchronously until its first `await`.
|
|
|
650
757
|
| `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 `""` |
|
|
651
758
|
| `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 |
|
|
652
759
|
| `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 |
|
|
760
|
+
| `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 |
|
|
653
761
|
| `kill` / `emitWarning` / `getuid` / `getgid` | ✅ | — | Implemented, not probed |
|
|
654
762
|
| `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 |
|
|
655
763
|
| `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 |
|
|
764
|
+
| `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 |
|
|
765
|
+
| `process.version` / `versions.node` reporting Node 26 | ❌ | — | Both still report `v24.0.0` / `24.0.0` ([src/node/process.ts](src/node/process.ts)) |
|
|
766
|
+
| `process.ref(x)` / `process.unref(x)`, `addUncaughtExceptionCaptureCallback`, `execve`, `process.permission` (`has`, `drop`) | ❌ | — | **Node 25 / 26**: `addUncaughtExceptionCaptureCallback` (25.9), `execve` throws on failure instead of aborting (26.1), `permission.drop` (26.3), `ref` / `unref` stable (26.11) |
|
|
656
767
|
|
|
657
768
|
#### `node:console`
|
|
658
769
|
|
|
@@ -663,23 +774,26 @@ async function runs synchronously until its first `await`.
|
|
|
663
774
|
|
|
664
775
|
#### `node:util`
|
|
665
776
|
|
|
666
|
-
| API | Status | Probe
|
|
667
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: |
|
|
668
|
-
| `format` / `formatWithOptions` (`%s %d %i %f %j %o %O %c %%`) | ✅ | [lib-node-util-format.ts](conformance/lib-node-util-format.ts)
|
|
669
|
-
| `inspect` (`depth`, `breakLength`, `compact`) | ✅ | [lib-node-util-inspect.ts](conformance/lib-node-util-inspect.ts)
|
|
670
|
-
| `isDeepStrictEqual` / `types.*` (`node:util/types`) / `deprecate` / `stripVTControlCharacters` / `styleText` | ✅ | [lib-node-util-misc.ts](conformance/lib-node-util-misc.ts)
|
|
671
|
-
| `promisify` / `callbackify` | ✅ | [lib-node-util-promisify.ts](conformance/lib-node-util-promisify.ts)
|
|
672
|
-
| `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)
|
|
673
|
-
| `inspect.custom` methods, `getCallSites` | ❌ | —
|
|
674
|
-
| `inherits` (legacy) | 🚫 | —
|
|
675
|
-
| Node's errno numbers per OS (`err.errno`, `getSystemErrorMap`) | ✅ | [lib-node-errno.ts](conformance/lib-node-errno.ts)
|
|
777
|
+
| API | Status | Probe | Notes |
|
|
778
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
779
|
+
| `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` |
|
|
780
|
+
| `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]` |
|
|
781
|
+
| `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` |
|
|
782
|
+
| `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 |
|
|
783
|
+
| `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) | |
|
|
784
|
+
| `inspect.custom` methods, `getCallSites` | ❌ | — | `[inspect.custom]()` can lower to a method like `[Symbol.dispose]()`; `getCallSites` can read `runtime.Callers`, which reports `.ts` lines through the `//line` directives |
|
|
785
|
+
| `inherits` (legacy) | 🚫 | — | Rewrites prototypes; classes are static Go structs |
|
|
786
|
+
| 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 |
|
|
787
|
+
| `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` |
|
|
788
|
+
| `debounce` / `throttle` / `markPromiseAsHandled`, `isPartialDeepStrictEqual`, `MIMEType.parse` (returns `null` instead of throwing), hex colours in `styleText` (`'#ff8800'`) | ❌ | — | **Node 26**: hex colours (26.1), `MIMEType.parse` (26.8), `debounce` / `throttle` / `markPromiseAsHandled` (26.10), `isPartialDeepStrictEqual` (26.11) |
|
|
676
789
|
|
|
677
790
|
#### `node:assert`
|
|
678
791
|
|
|
679
792
|
| API | Status | Probe | Notes |
|
|
680
793
|
| ------------------------------------------------------------------------------------------------------------------------------------- | :----: | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
681
794
|
| `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 |
|
|
682
|
-
| `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)
|
|
795
|
+
| `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** |
|
|
796
|
+
| `printf`-style messages (`assert.ok(v, 'got %s', x)`) and message functions on every assertion; `partialDeepStrictEqual` | ❌ | — | **Node 26** (printf messages). The type check rejects extra message arguments today (`Expected 1-2 arguments`) |
|
|
683
797
|
|
|
684
798
|
#### `node:url`
|
|
685
799
|
|
|
@@ -727,6 +841,7 @@ async function runs synchronously until its first `await`.
|
|
|
727
841
|
| `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 |
|
|
728
842
|
| 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 |
|
|
729
843
|
| Encrypted private keys (`passphrase` / `cipher`), `rsa-pss` / `dsa` / `dh` / `ed448` / `x448` key types, `secp256k1`, `Certificate` (SPKAC) | ❌ | — | Not in Go's standard library, but portable: encrypted PKCS#8 is PBES2 over `pbkdf2` + AES-CBC; `rsa-pss` / `dsa` / `dh` keys and SPKAC are ASN.1 on existing primitives; `secp256k1` / `ed448` / `x448` need vendored curve code |
|
|
844
|
+
| `randomUUIDv7`, `createMac` / `getMacs` / `Mac` (`update` / `final`), `parsePKCS12`, SIV and GCM-SIV cipher modes | ❌ | — | **Node 26**: `randomUUIDv7` (26.1), SIV / GCM-SIV (26.8), `createMac` (26.9), `parsePKCS12` (26.10). A v7 UUID is a millisecond timestamp plus `crypto/rand` bits; PKCS#12 is the decoder [tls](#nodetls) PFX needs too |
|
|
730
845
|
|
|
731
846
|
#### `node:zlib`
|
|
732
847
|
|
|
@@ -736,6 +851,8 @@ async function runs synchronously until its first `await`.
|
|
|
736
851
|
| `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 |
|
|
737
852
|
| 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 |
|
|
738
853
|
| 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 |
|
|
854
|
+
| ZIP archives: `ZipFile` (`open(Sync)`, `get` / `add` / `delete` / `compact`, `stream`), `ZipBuffer`, `ZipEntry`, `createZipArchive(Sync)`, `zipFiles`, `get/setMaxZipContentSize` | ❌ | — | **Node 26** (26.8). Feasible on Go's `archive/zip` |
|
|
855
|
+
| Iterable compression: `compressGzipSync()` / `decompressGzipSync()` and the Deflate / Brotli / Zstd variants; Zstd itself (`zstdCompress(Sync)` & co.) | ❌ | — | **Node 25** (25.9) for the iterable forms. Zstd needs a vendored pure-Go codec (`klauspost/compress/zstd`) |
|
|
739
856
|
|
|
740
857
|
#### `node:timers`
|
|
741
858
|
|
|
@@ -751,6 +868,7 @@ async function runs synchronously until its first `await`.
|
|
|
751
868
|
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----: | ------------------------------------------------------------------ | ------------------------------------------------- |
|
|
752
869
|
| `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 |
|
|
753
870
|
| `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 |
|
|
871
|
+
| Histogram statistics (`cdf` / `ccdf` / `countAt` / `percentileCI` / `meanCI` / `skewness` / `kurtosis` / `ewma*`, `welchTest` / `ksTest` / `mannWhitneyTest` / `cohensD`, `subtract` / `diff` / `snapshot`, `export` / `importHistogram`), `recordCorrected`, `createSlidingWindowHistogram` | ❌ | — | **Node 26** (26.8 – 26.11). Arithmetic over the recorded values |
|
|
754
872
|
|
|
755
873
|
#### `node:tty`
|
|
756
874
|
|
|
@@ -788,6 +906,7 @@ async function runs synchronously until its first `await`.
|
|
|
788
906
|
| `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 |
|
|
789
907
|
| `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 |
|
|
790
908
|
| Backpressure (`highWaterMark` beyond `write()`'s return value), `compose` with generator functions | ❌ | — | Not implemented yet |
|
|
909
|
+
| `duplexPair`, `Duplex.toWeb` `readableType`, `readable[Symbol.for('Stream.toAsyncStreamable')]()` | ❌ | — | **Node 25 / 26**: `readableType` (25.7); `duplexPair` destroys both ends together (26.1); `compose` is stable (26.2) |
|
|
791
910
|
|
|
792
911
|
#### `node:stream/web`
|
|
793
912
|
|
|
@@ -874,6 +993,7 @@ async function runs synchronously until its first `await`.
|
|
|
874
993
|
| `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` |
|
|
875
994
|
| Trailers on client requests, `Agent` socket pooling control | ❌ | — | Feasible: Go's `Request.Trailer`, `Transport.MaxConnsPerHost` / `MaxIdleConnsPerHost` |
|
|
876
995
|
| `statusMessage` on responses we send, `'checkContinue'` | ❌ | — | Go's `ResponseWriter` sends its standard reason phrases and answers `100-continue` itself: needs a hijacked connection |
|
|
996
|
+
| `res.writeInformation(status, headers)` (any 1xx), `req.signal`, `isValidHeaderName` / `isValidHeaderValue`, `websocketMask` / `websocketUnmask`, the `httpValidation` option | ❌ | — | **Node 26**: `req.signal` (26.1), `writeInformation` (26.2), `httpValidation` (26.3), header checks (26.11), WebSocket masking (26.12). Removed in 26.0: `writeHeader` (never declared here) |
|
|
877
997
|
|
|
878
998
|
#### `node:http2`
|
|
879
999
|
|
|
@@ -924,18 +1044,20 @@ async function runs synchronously until its first `await`.
|
|
|
924
1044
|
|
|
925
1045
|
#### `node:test`
|
|
926
1046
|
|
|
927
|
-
| API
|
|
928
|
-
|
|
|
929
|
-
| `test` / `it` / `describe` / `suite` (+ `.skip` / `.todo` / `.only`; `skip` / `todo` / `timeout` options); sync, async and `done`-callback tests
|
|
930
|
-
| `before` / `after` / `beforeEach` / `afterEach` (file and suite level, `t.before` & co.)
|
|
931
|
-
| `TestContext`: `t.test` subtests, `t.skip`, `t.todo`, `t.diagnostic`, `t.plan`, `t.name`, `t.fullName`, `t.signal`, `t.mock`
|
|
932
|
-
| 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
|
|
933
|
-
| `mock.fn(original?, implementation?)`; `fn.mock.calls` / `callCount()` / `mockImplementation(Once)` / `resetCalls()` / `restore()`
|
|
934
|
-
| `t.assert` (`node:assert`'s functions, counted by `t.plan`) and `mock.timers` (`enable({ apis, now })`, `tick`, `runAll`, `setTime`, `reset`; `setTimeout` / `setInterval` / `setImmediate` / `Date`)
|
|
935
|
-
| `mock.method` / `mock.getter` / `mock.setter`
|
|
936
|
-
| `NODE_OPTIONS` flags: `--test-name-pattern` / `--test-skip-pattern` (repeatable, `/re/flags`), `--test-only`, `--test-reporter=tap\|spec\|dot\|junit
|
|
937
|
-
| Snapshots
|
|
938
|
-
|
|
|
1047
|
+
| API | Status | Probe | Notes |
|
|
1048
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :----: | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1049
|
+
| `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 |
|
|
1050
|
+
| `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 |
|
|
1051
|
+
| `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) | |
|
|
1052
|
+
| 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 |
|
|
1053
|
+
| `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 |
|
|
1054
|
+
| `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 |
|
|
1055
|
+
| `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 |
|
|
1056
|
+
| `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 |
|
|
1057
|
+
| 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 |
|
|
1058
|
+
| `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 |
|
|
1059
|
+
| 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 |
|
|
1060
|
+
| `t.log` / `'test:log'`, `getTestContext`, `t.passed` / `t.attempt` / `t.workerId`, tags (`t.tags`), `--test-randomize` / `--test-random-seed`, `'test:interrupted'`, `t.assert.called` / `callCount` / `nthCalledWith` / `lastCalledWith`, `--test-coverage-include-all` | ❌ | — | **Node 25 / 26**: `'test:interrupted'` (25.7), `workerId` (25.8), `getTestContext` / randomized order (26.1), tags (26.2), `t.log` (26.6), `--test-coverage-include-all` (26.7), call assertions (26.12) |
|
|
939
1061
|
|
|
940
1062
|
#### `node:worker_threads`
|
|
941
1063
|
|
|
@@ -971,8 +1093,11 @@ network; it adds about 10 MB to a binary. Rows are records: `row.name`, `row as
|
|
|
971
1093
|
| `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 |
|
|
972
1094
|
| `loadExtension` / `enableLoadExtension` | 🚫 | — | SQLite runs as Wasm inside the program; native extensions can't load |
|
|
973
1095
|
| `createSession` / `applyChangeset` | ❌ | — | The bundled SQLite build has no session extension: needs an emulation over the preupdate hook (hard) |
|
|
974
|
-
| `serialize(dbName?)` / `deserialize(buffer, { dbName })` | ✅ | [lib-node-sqlite-serialize.ts](conformance/lib-node-sqlite-serialize.ts) |
|
|
975
|
-
| `undefined` as a parameter value
|
|
1096
|
+
| `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 |
|
|
1097
|
+
| `undefined` as a parameter value | ✅ | — | Binds NULL, as **Node 26** (26.10) does; Node 24 threw. `undefined` and `null` are both `nil` |
|
|
1098
|
+
| `[Object: null prototype]` rows | 🚫 | — | Rows print as plain objects |
|
|
1099
|
+
| `Database` / `Statement` class names | ❌ | — | **Node 26** (26.11) renames them; `DatabaseSync` / `StatementSync` stay as deprecated aliases (DEP0210). Only the `*Sync` names are declared |
|
|
1100
|
+
| `statement.close()` / `statement[Symbol.dispose]()` / `stat(counter)` / `resetStats()`, `database.createModule(name, options)` (virtual tables) | ❌ | — | **Node 26**: statement methods (26.8), `createModule` (26.11) |
|
|
976
1101
|
| 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 |
|
|
977
1102
|
|
|
978
1103
|
#### `node:inspector`
|
|
@@ -1025,16 +1150,17 @@ network; it adds about 10 MB to a binary. Rows are records: `row.name`, `row as
|
|
|
1025
1150
|
| API | Status | Probe | Notes |
|
|
1026
1151
|
| ----------------------------------------------------------------------------- | :----: | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
1027
1152
|
| `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 |
|
|
1153
|
+
| `builtinModules` as Node 26 lists it | ❌ | — | **Node 26** drops `_stream_duplex` & co. (removed in 26.0) and, since Node 23.5, lists the scheme-only `node:ffi` / `node:sea` / `node:sqlite` / `node:test` / `node:test/reporters` |
|
|
1028
1154
|
| `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`) |
|
|
1029
1155
|
| `findPackageJSON`, `require` of modules | ❌ | — | Feasible: a literal module specifier resolved at compile time like an import |
|
|
1030
|
-
| `register` / `registerHooks` (loader hooks), `require` of computed specifiers | 🚫 | — | Hooks into a JavaScript loader; imports are resolved at compile time
|
|
1156
|
+
| `register` / `registerHooks` (loader hooks), `require` of computed specifiers | 🚫 | — | Hooks into a JavaScript loader; imports are resolved at compile time. **Node 26** runtime-deprecates `register` |
|
|
1031
1157
|
|
|
1032
1158
|
#### `node:test/reporters`
|
|
1033
1159
|
|
|
1034
|
-
| API | Status | Probe
|
|
1035
|
-
| ------------------------------------------- | :----: |
|
|
1036
|
-
| `tap` / `spec` / `dot` / `junit` as exports |
|
|
1037
|
-
| `lcov` |
|
|
1160
|
+
| API | Status | Probe | Notes |
|
|
1161
|
+
| ------------------------------------------- | :----: | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1162
|
+
| `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 |
|
|
1163
|
+
| `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)) |
|
|
1038
1164
|
|
|
1039
1165
|
#### `node:domain`
|
|
1040
1166
|
|
|
@@ -1042,6 +1168,12 @@ network; it adds about 10 MB to a binary. Rows are records: `row.name`, `row as
|
|
|
1042
1168
|
| ------------------- | :----: | ----- | ------------------- |
|
|
1043
1169
|
| `create` / `Domain` | 🚫 | — | Deprecated upstream |
|
|
1044
1170
|
|
|
1171
|
+
#### `node:ffi`
|
|
1172
|
+
|
|
1173
|
+
| API | Status | Probe | Notes |
|
|
1174
|
+
| ----------------------------------------------------------------------- | :----: | ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1175
|
+
| Loading dynamic libraries and calling native symbols, `getCurrentEventLoop` | ❌ | — | **Node 26**: added in 26.1, on by default since 26.9 (still experimental). Without cgo this needs a pure-Go `dlopen` (`purego`) or `syscall.LoadDLL` on Windows; [`go:*` bridges](#go-bridges-go) already call Go code |
|
|
1176
|
+
|
|
1045
1177
|
### Go bridges (`go:*`)
|
|
1046
1178
|
|
|
1047
1179
|
Status: ✅ probed, 🚫 can't work in a TypeNative program (see [Known limitations](#known-limitations-)).
|
|
@@ -1254,10 +1386,48 @@ Status: ✅ probed, 🚫 can't work in a TypeNative program (see [Known limitati
|
|
|
1254
1386
|
|
|
1255
1387
|
### npm packages
|
|
1256
1388
|
|
|
1257
|
-
| Pattern
|
|
1258
|
-
|
|
|
1259
|
-
| `import { x } from 'pkg'`
|
|
1260
|
-
| Packages published as plain JavaScript / CommonJS
|
|
1389
|
+
| Pattern | Status | Probe | Notes |
|
|
1390
|
+
| ------------------------------------------------- | :----: | -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
1391
|
+
| `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)) |
|
|
1392
|
+
| 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 |
|
|
1393
|
+
|
|
1394
|
+
### Native app windows (`@webviewjs/webview`)
|
|
1395
|
+
|
|
1396
|
+
Programs open windows through the [`@webviewjs/webview`](https://www.npmjs.com/package/@webviewjs/webview)
|
|
1397
|
+
API, so the same source runs under Node.js (the real package) and compiled (a built-in
|
|
1398
|
+
implementation, no npm package needed). Build a windowed app with `--gui`. Anything not listed
|
|
1399
|
+
here is a type error when compiled.
|
|
1400
|
+
|
|
1401
|
+
| API | Status | Probe | Notes |
|
|
1402
|
+
| ----------------------------------------------------------------------------------------------------- | :----: | ---------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
1403
|
+
| `new Application()`, `run`, `exit`, `isReady`, `whenReady` | ✅ | [lib-webview-api.ts](conformance/lib-webview-api.ts) | `ApplicationOptions` aren't accepted |
|
|
1404
|
+
| `app.createWebContext({ dataDirectory })` | ✅ | [lib-webview-api.ts](conformance/lib-webview-api.ts) | Without one, compiled apps use the per-user cache folder |
|
|
1405
|
+
| `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 |
|
|
1406
|
+
| `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 |
|
|
1407
|
+
| `win.setTitle`, `win.close` | ✅ | [lib-webview-api.ts](conformance/lib-webview-api.ts) | |
|
|
1408
|
+
| `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` |
|
|
1409
|
+
| 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 |
|
|
1410
|
+
| `event.preventDefault()` on `close` | 🚫 | — | The window is already gone when `close` arrives: save before it, for example on the page's `beforeunload` |
|
|
1411
|
+
| Menus, tray icons, notifications, IPC (`expose`, `onIpcMessage`), custom protocols, window controls | ❌ | — | Not implemented |
|
|
1412
|
+
|
|
1413
|
+
How a window is hosted:
|
|
1414
|
+
|
|
1415
|
+
| Platform | Window | Closing it is detected by | Verified |
|
|
1416
|
+
| ---------------------------------------- | -------------------------------------- | ------------------------------------- | ---------------------------------------------------------- |
|
|
1417
|
+
| Windows | Embedded WebView2, pure Go, no cgo | The window's message loop ending | Run end to end |
|
|
1418
|
+
| Windows without the WebView2 runtime | Edge or Chrome in app mode | A job object emptying | Run end to end (`TYPENATIVE_WEBVIEW=browser` forces this) |
|
|
1419
|
+
| 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 |
|
|
1420
|
+
|
|
1421
|
+
With no browser to open, opening the window throws `ERR_WEBVIEW_NO_BROWSER`. Run
|
|
1422
|
+
[app-webview-window.ts](conformance/app-webview-window.ts) with `TN_WEBVIEW_SMOKE=1` to open a real
|
|
1423
|
+
window: the suite skips it otherwise, since CI has no display.
|
|
1424
|
+
|
|
1425
|
+
Under Node.js on Windows the package has a pitfall that compiled programs don't: while the window
|
|
1426
|
+
is idle, its event pump can hold the JS thread until a window message arrives (seen on 0.6.0 and
|
|
1427
|
+
1.0.0-rc.4, and `controlFlow` doesn't change it), which starves timers and an HTTP server in the
|
|
1428
|
+
same process. [desktop-notes](examples/desktop-notes/) gives the window its own process there. Its
|
|
1429
|
+
default profile folder is beside `node.exe`, which is read-only under Program Files, so pass a
|
|
1430
|
+
`dataDirectory`.
|
|
1261
1431
|
|
|
1262
1432
|
## Known limitations (🚫)
|
|
1263
1433
|
|