mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-10-29 07:04:09 +08:00
Any computed write with a key TypeScript cannot know (zod's `curr[el] = ...` in ZodError.js, for one) puts every class method name in the method census. Every typed call of such a method then went through the observable prototype slot: a dynamic call with boxed arguments, followed by a checked conversion of the result (for a `Product[]` result, a deep walk of every element). Bundling untyped JavaScript made unrelated typed code several times slower per call. The prototype data now keeps each observed method's original value in a global. A typed, non-virtual call of a TypeScript method still reads the slot first, as before, and calls the method natively when the slot holds that original value. A replacement, on the prototype or as an own property, still takes the dynamic call. Virtual calls and methods declared in unchecked JavaScript keep the dynamic call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>