You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
const a: A
Type '{ prop1?: string | undefined; prop2?: string | undefined; }' is not assignable to type 'A'.
Type '{ prop1?: string | undefined; prop2?: string | undefined; }' is not assignable to type '{ prop1: string; prop2?: string | undefined; }'.
Types of property 'prop1' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.(2322)
π Expected behavior
No errors
ts 4.1.5 works as expected, without errors
The text was updated successfully, but these errors were encountered:
Yeah, this was an intentional reduction in spread accuracy - typically there's a lot of exists-or-empty-object spreads like this in a single object (eg, for css or props in the wild), and so the higher accuracy spread logic just costs too much (has exponential check times).
Bug Report
There's a regression with unions is introduced in typescript 4.2
π Search Terms
union, spread, 4.2
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
Error:
π Expected behavior
No errors
ts 4.1.5 works as expected, without errors
The text was updated successfully, but these errors were encountered: