mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-02 07:43:42 +08:00
- Destructuring an `any` value in TypeScript (a function typed `any`, an awaited `any`, `JSON.parse`, an `any` table read) now goes through the checked-dynamic value, as JavaScript sources and #1407's JS-declared results already did. Object sources get V8's RequireObjectCoercible TypeError for the spellings the assignment form reproduces. - A method call or member read on a checker-`any` receiver whose value is a fresh typed call result (`out.split("\n").map(...)`, `.pop()`, `.length`) boxes that temporary and dispatches on the runtime kind, only after every other lowering declined. - `const { a, b: c } = ns` and `= await import("./m")` over a program module bind each export the way `ns.a` reads it. - A defaulted parameter of a program-source function, arrow or function expression that the checker types `any` (a default under an `(...args: any[]) => any` wrapper slot, where the contextual `any` wins) is a dyn ABI slot in the callable's type. - An async lambda whose signature answered a bare dyn result (a library slot `A | Promise<A>` with A = any) produces Promise<unknown>. - `761-any-objects` compiles and moves back to the corpus; the retired-engine 2083/2104 snapshots shrink to their remaining fences. - JavaScript `Promise.resolve(value)` (in a JavaScript file) over a dyn value holding a promise answers that promise instead of wrapping it, so a TypeScript async callback's result is adopted by JavaScript retry helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
16 lines
679 B
TypeScript
16 lines
679 B
TypeScript
// Object/array literals in `any` slots: property reads/writes, computed
|
|
// keys, and method calls go through the checked-dynamic value, including a
|
|
// member read on a fresh typed call result (`s.split(" ").length`).
|
|
const o: any = { a: 1, b: "x", nested: { deep: true } };
|
|
o.a = o.a + 10;
|
|
o["c"] = 2.5;
|
|
console.log(`${o.a} ${o.b} ${o.c}`, `${o.nested.deep}`, typeof o);
|
|
const arr: any = [1, "two", true];
|
|
arr[3] = o.a;
|
|
console.log(`${arr.length}`, `${arr[1]}`, `${arr[3]}`);
|
|
console.log(`${arr.join("|")}`);
|
|
const s: any = "hello world";
|
|
console.log(`${s.toUpperCase()}`, `${s.split(" ").length}`, `${s.charAt(4)}`);
|
|
const num: any = 3.14159;
|
|
console.log(`${num.toFixed(2)}`);
|