mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
A lambda declaring an optional or defaulted trailing parameter — the `(a, b, loose?) => …` semver comparator, the sort callback whose surplus position is a flag — was refused at its birth fence (SC1090) even though every read of it spells that position as `T | undefined`, the completed native ABI. The fence compared the slot's mapped type against the contextual lambda's, which misses two shapes the checker accepts: a lambda whose own `any` parameter mapType leaves unmapped, and a *contextually* typed lambda whose OWN signature is wider than the slot it is written under. requireExactArityValue now admits a lambda whose own call signature maps to the slot position for position, and cleanFuncAdaptable accepts a source with extra trailing parameters when each of them completes with the undefined value, the same absence a call through the slot passes. `sort`/`toSorted` separately required a comparator of at most two parameters; it now adapts the first two and lets the surplus ones complete as undefined, so the imported three-parameter comparator sorts. Corpus 8529 pins the surplus-parameter comparators (optional, defaulted, `any`-typed), the direct calls through them, `toSorted`'s untouched receiver, and remains byte-exact against Node. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>