Files
scriptc/packages/compiler
Malte UblandClaude Opus 5.5 830ee3ddf3 Build a fresh object literal at an async record result
An unannotated async method inside a contextually typed object literal is
checked against the contextual signature's result, while its own inferred
return type stays the returned literal's narrower record. The async return
lowered the literal untyped and then coerced that wider record into the
declared result, which refused on `content`: the wider content-part union
array does not lift into the inferred text-record array. A ToolDefinition
execute reached through a Record<Name, ToolDefinition> hit the same
SC2002.

A fresh object literal returned into a record result is not a thenable,
so when the ordinary construction cannot convert it is now built at the
result slot, in both the synchronous and the promise-adopting return
paths. The field-set comparison also considers the literal's own checker
type, not only the contextual type it was checked against. Both the
return-path rule and the object-literal rule ask the same question first —
does the record the ordinary path builds have a width plan into the
result? — so a literal that converts today, and every value that is not a
fresh literal, keeps its exact lowering.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 19:11:25 -07:00
..
2026-10-29 16:39:31 -05:00
…
2026-10-29 06:02:00 -05:00