Repository navigation
0.4.15
Highlights
- Node.js parity:
SetandMaptakeMap,Setand typed-array elements: each is one object for its whole life, so JavaScript compares it by identity, and the collection holds it, finds it, deletes and re-adds it, iterates it in insertion order and seeds anotherMapfrom[key, value]pairs holding it, instead of failing with SC2020;Set<Uint8Array>andMap<Map<string, number>, T>compile and keep two objects with equal contents apart.- A collection constructor's seed cast from an untyped value,
new Set(u as Key[])whereuisunknown, lowers as the ordinary checked array conversion rather than as a single key, so it compiles likeconst keys = u as Key[]; new Set(keys)and every element keeps the identity the untyped name still sees; a key written on its own (set.add(u as Key)) stays refused, because copying a key would change the object the collection holds. - A class declared in a module of an import cycle behaves as Node's temporal dead zone makes it: a reference that can run before the class statement —
new, a static read, the class value,instanceof, a subclass'sextendsclause in another module, generic classes included — throws Node'sReferenceErrornaming the binding, and every later reference sees the one class, instead of the program failing to build with SC1016. The check sits where the class is read, so a computedextendsexpression keeps its own work and its unselected arms: only a heritage expression that IS the class value — a name, a namespace member, a parenthesized or asserted one — carries it, while animplementsclause and a heritage type argument, which Node erases, carry none. RegExp(pattern, flags)called withoutnewcompiles as the constructor call Node runs, instead of throwing SC2020 at startup, and a RegExp pattern whose flags argument is undefined — spelled that way or only undefined at run time — answers the pattern itself, keeping its identity andlastIndex; a pattern the compiler cannot see is a string is judged by the runtime, so an untyped pattern keeps that rule too.- sqlite:
node:sqlitecompiles, fromDatabaseSyncandStatementSyncthroughbackup(), user functions, aggregates, sessions, serialization and tag stores, with statement results and row values that can be stored. - worker_threads: workers answer
resourceLimits,cpuUsageand loop metrics throughworker.performance, carryBlob,File,MapandSetvalues through messages, validate transfer lists, answer a fresh promise from everyterminate()call, and exposestdoutandstderrwithout stream options. - http and https: agents take Node's keep-alive hooks,
createConnectionandmaxTotalSockets, requests take Node's header value forms and supportwriteInformation, write callbacks and cork/drain, andIncomingMessagereportssignal, finished and destroyed state. - http2: trailers, informational responses and stream error codes follow Node, alongside the server, settings and session surface.
- stream:
Readable.toWeb,Writable.toWeb,Duplex.fromWeb,duplexPair,readable.wrapandreadable.iteratorcompile,ReadableStream.values()works as a stored iterator,stream/consumershandles blobs, and high-water marks and close ordering match Node. - fs:
fs.watchrecurses on Linux and Windows,fsPromises.watchandStatWatcherfollow Node's liveness,readdiraccepts every encoding withwithFileTypesand recursive listing,mkdtempDisposablecompiles, andFileHandlecloses throughSymbol.asyncDisposeand answers a readable web stream. - crypto: X448, ML-KEM, Argon2, KMAC, SHA-3, cSHAKE, TurboSHAKE and KangarooTwelve compile; WebCrypto adds AES-OCB, ChaCha20-Poly1305, ECDH, X25519 and RSA-OAEP, converts KeyObjects to CryptoKeys and back, and derives public keys.
- tls: servers build through the class,
tls.exportKeyingMaterialcompiles, and native verification applies Node's blocked-SPKI policy. - dgram: the socket class, udp6 and the synchronous members compile, with block lists and bind options enforced as Node enforces them.
- console and util: the whole
Consoleprototype compiles with per-instance state,inspectOptionsand color mode are honored,console.createTaskanswers Node's task object, global console calls publish their arguments on their diagnostics channels,util.inspect compactandutil.getCallSitescompile, andconsole.tableinspects cells with the instance's options. - module:
module.findPackageJSON,import.metaas a value,export *over CommonJS modules, CommonJS metadata reads and exports chosen at run time compile. - perf_hooks:
createHistogramandRecordableHistogramcompile with skewness, kurtosis, confidence intervals and Welch's t-test, andperformance.timerifyand resource timing entries are supported. - node:test: subtests with options, test tags,
t.planoptions, suite timeouts,t.signal,t.error, mock contexts and records, snapshot serializers, the callback form and tracing-channel events compile. - globals and events:
BroadcastChannel,MessagePortas anEventTargetwithMessageEventandCloseEvent,structuredCloneof primitive wrappers,AsyncResourceandAsyncLocalStorage.withScopeover async hooks,trace_events,AbortSignalinstanceof,navigatorand performance entry tags compile. - buffer and assert:
Buffer.copyBytesFromandbuffer.resolveObjectURLcompile,Buffercopy, search and optional positions match Node, andassertacceptsErrorobjects and non-string messages with Node'sgeneratedMessageand property order.
- TypeScript parity:
- A relative JavaScript import resolves to its sibling declaration for types, as tsc resolves it:
./lib.jsis typed bylib.d.ts,./lib.mjsbylib.d.mtsand./lib.cjsbylib.d.ctswhen the file sits beside the JavaScript, while the compiled module is the JavaScript Node loads. A call is checked against the declaration (an optional declared parameter stays optional although the JavaScript's inferred parameter type requires it), so a vendored dependency keeps its published types instead of losing them to the JavaScript's inferred shape. A declaration a project's tsconfigincludeloads beside its implementation also stays in the program, where a JSX project previously reported it as a missing file. - A promise executor's
resolvecalled without an argument, such as arequestAnimationFramecallback that settles its promise when the frame arrives, compiles instead of failing with SC0001: Node settles the promise withundefined, the checker reports the call as TS2810, the JavaScript spelling of the arity error that names the missing JSDoc hint, and unchecked JavaScript admits that diagnostic as it already admits TS2554, while a// @ts-checkfile, or a project that setscheckJs, keeps it. A program that does not hit the diagnostic compiles to the same IR. - A
fetchoverload set merged fromlib.domand the Node declarations compiles as one function, so a record holding it stays static. - A
voidcall's value, read through a variable in a truthiness test, compiles. - A
varread above its declaration compiles when every read follows the store. - Operators in unchecked JavaScript read the value a binding actually holds.
arguments.lengthcounts in functions with optional, default or rest parameters.require()inside a function or immediately-invoked function evaluates once and answers the same exports object, while CommonJSvarandletbindings holdingrequire()stay mutable.- Inline callbacks in JSX attributes take the attribute's contextual types.
- A destructuring of a
void-typed value compiles, function declaration bindings can be replaced, and a named function expression's inner binding keeps its refusal.
- A relative JavaScript import resolves to its sibling declaration for types, as tsc resolves it:
- Performance:
- Loop counters now carry integer facts and aligned function entries, and a small loop callee inlines together with the bodies it calls.
- Programs that do not use promises no longer link the promise unit, and programs without workers no longer link their dynamic invocation support.
- A self-slicing string scan reads the base string at an offset instead of copying it.
Fixes
-
A checked-dynamic module global, such as the object literal React's bundles build for a context, keeps that storage when the optional analysis would narrow it, so a function declared above the declaration reads the global at the type it holds instead of failing the build with an internal error. A discarded conditional of void calls under
&&or||lowers as the branch it is, instead of failing the same way. -
console.createTaskcompiles the way Node 24 runs it: the call answers a task object whoserun(callback)calls the callback and answers its result, the global console member is one function value (so React's development build can store it in a binding and call it there), and aConsoleinstance answersundefined, as Node's instances do. A missing or non-string name, and a callback that is not a function, throw Node's messages. -
A callback written inline in a JSX attribute keeps the types the element's attribute type gives its parameters, for intrinsic elements and components: the rewrite constrains an expression whose functions have no annotations with the slot's contextual type (read through the component's own props type, so a prop type private to the component's module stays usable), so
onClick={(event) => event.button}lowers witheventtyped instead of failing preflight with SC0001, and a JavaScript file keeps the unchecked lowering it had. -
A
require()inside a function or an immediately-invoked function compiles as Node's loader runs it: the dependency evaluates on the require's first call and every later require — the same call again, another function, or a plain statement — answers the same exports object, so a library that wrapsrequire("react")in an IIFE (React's development jsx-runtime) builds and runs. A module whose exports form a static table answers such a nested require with the runtime's per-module view over its export globals, so member reads are live and identity holds across requires; that view is read-only and lists its keys sorted, where Node's exports object accepts writes and keeps insertion order, and the top-level spelling keeps its named value fence. -
A
typeofcomparison against a literal notypeofcan answer, such as React's"unknown" !== typeof event.returnValue, compares the runtime kind string instead of refusing the program, and the operand still evaluates once.process.emiton the exception events calls their listeners, answers whether any existed and propagates a listener's throw, as Node's emitter does; the specialerrorevent throws Node's unhandled-error error, and a spread argument vector is built before any listener runs. -
A CommonJS
var/letholdingrequire()'s result is an ordinary mutable binding, as in Node:var lib = require("./lib.cjs"); lib = { … }compiles, the declaration still evaluates the module, and reads and writes of the binding see the replacement. A module that exports one value (module.exports = function …) or one object literal (module.exports = { … }) supplies the stored value; a module that assigns its members one by one (exports.x = …) keeps a named refusal until its exports object has a first-class value. An ES import binding and aconstrequire binding stay immutable. -
A
varread above its declaration compiles when every read is proven to run after the first store: a function declared above the variable reads the value the declaration stored, in the binding's own storage, where the build previously reported SC1030. A read that can run before the store keeps answeringundefined, including one behind a non-null assertion or a declaration writtenvar x!: T. -
An operator in an unchecked JavaScript file reads the value a binding actually holds, not the shape one assignment gave it: shipped JavaScript reuses one
varfor a property descriptor, an array of stack lines and a count, so1 <= namePropDescriptor,RunInRootFrame++,hostSiblings += 1andgetTargetInstFunc && …compile to the dynamic conversion Node applies instead of failing with SC0001 or SC1090. Avarread before its first assignment answersundefined, as the hoisted declaration does in Node. A// @ts-checkfile keeps the checker's diagnostics, and an operator whose operand is a static object keeps its refusal. -
A module namespace object read through a value the checker cannot resolve, such as
(ns as any).log, answersundefinedfor a name the module does not export and the export for one it does, as Node does, instead of failing with SC1090. -
A function declaration's binding can be replaced (
value = () => 2), as Node's mutable binding allows, and a named function expression's own inner binding keeps its refusal, where strict code throws. A truthiness test of avoid-typed call through a plain object's member reads the value the call answered, because the function the program stores in that member keeps its own result.value instanceof AbortSignaltests the runtime's signal handle, answeringtruefor a signal andfalsefor every other value, andnew AbortSignal()throws Node'sERR_ILLEGAL_CONSTRUCTOR. -
A checked value from an indexed object's optional member, such as
JsonWebKey'salg?: stringover[key: string]: unknown, keeps the presentundefineda(T | undefined)[]slot admits instead of throwingexpected string at $, got undefined: an array literal, an index write,push,unshift,splice,toSpliced,with,fill,Array.ofandnew Array(...)printnullfromJSON.stringifyand read back asundefined, as Node does. -
A property descriptor read from a class's prototype through an untyped value, such as a UI SDK's
Object.getOwnPropertyDescriptor(Object.getPrototypeOf(el), "value"), builds and answers Node's descriptor — the accessor pair the class declares, with its attributes — instead of failing the build with an empty SC3004: a class value's static table reflects a static method whose parameters complete as the checked-dynamic function Node holds, and a member the table cannot hold leaves the class's statics fenced rather than aborting lowering. Building the prototype view itself no longer reports the retry's diagnostic for a member whose body cannot run over a dynamic receiver (a typed field used as aMapkey, say); that statement fences at run time. A native build that fails inside the compiler now names the failure, and no SC3002–SC3004 diagnostic is empty. -
A class method read from a prototype view — an untyped value's
Object.getPrototypeOf, or a descriptor taken from it — runs its class's compiled method instead of throwing at run time: a member whose body reads a generic method throughthis(a DOM node'sinsertBeforecallingthis.appendChild) has no checked-dynamic form to hand out, so the view answers that member's compiled, receiver-checked value and the body keeps the class's ownthis, where the generic call lowers as its typed call site does. -
Release stack frames record call and throw positions, and
Error.prepareStackTracecompiles as program state. -
A class value's statics table and prototype views answer accessors, descriptors and subclass
instanceofas Node does. -
require(esm)and partial CommonJS cycles follow Node's semantics.