mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-31 07:23:06 +08:00
A top-level return in a CommonJS module compiles when declarations follow it. When the return is taken, only code that already exists can observe the bindings it skips: functions and classes created before the return, and function declarations after it. A module where one of them reads a binding declared after the return, or that assigns exports after it, still stops with SC1090. assert.strictEqual and assert.notStrictEqual compare a nullable number, string or boolean (`number | null`, `string | null`) with a scalar, null or undefined through the checked-dynamic SameValue compare, which reports Node's failure messages. notStrictEqual of another nullable value, such as `child.stdin`, against null or undefined tests the value's tag. An initializer-less JavaScript `let` whose writes all agree also takes their type when the writes are calls declared in the standard library, such as `spawn(...)`, and at file scope. A runtime handle that a closure captures takes the handle or undefined. Inside a nested function, a member read on it (`c.address()`, `child.stdin`) reads the handle and throws Node's TypeError while the binding is still undefined; other reads there take the checked-dynamic value.