mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
Typed records checked from frozen untyped values stay frozen, as the objects they copy are. A sloppy-mode function called with undefined or null as this receives the global object that globalThis reads. The record check reads the source's integrity with a query that answers for every value: a proxy answers as its target, and values without a modeled integrity level, which Object.freeze refuses, are not frozen. Object.isFrozen keeps its refusal of those values.
10 lines
1.5 KiB
Plaintext
10 lines
1.5 KiB
Plaintext
- **Function values:** Immutable aliases of overloaded program functions retain per-call overload resolution and identity.
|
|
A function stored in a slot with a different signature remains the same function for equality, array searches, `length`, and own properties.
|
|
Typed rest-parameter functions can be stored and called indirectly, including through a slot with fixed parameters, where the slot's arguments arrive in the rest array.
|
|
Builtin function values have API-specific restrictions; see [Builtin function values](#builtin-function-values).
|
|
- **JavaScript parameters:** In a JavaScript file TypeScript does not check, a prototype method (`C.prototype.m = function (...) {}`) takes whatever values its callers pass; its JSDoc types document the usual values without constraining them.
|
|
A sloppy-mode function with named parameters may read `arguments` only where the aliasing of its parameters cannot show: it reads `arguments.length`, or reads elements and never writes a parameter or an element.
|
|
Other uses of `arguments` in such a function are refused with `SC1090`; ES modules, `'use strict'` code, classes, and functions with default, rest, or destructured parameters have no such restriction.
|
|
A sloppy-mode function called with `undefined` or `null` as its receiver gets the global object as `this`, as in Node.
|
|
Called with a primitive receiver, its `this` is the primitive itself, where Node passes the primitive's wrapper object (`typeof this` is `"object"` there).
|