mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-01 07:33:12 +08:00
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>