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
{{ message }}
Repository navigation
Union of variant setters uses getter type for assignmentΒ #45376
classOne{getprop(): string{return"";}setprop(s: string|number){}}classTwo{getprop(): string{return"";}setprop(s: string|number){}}declareconstu1: One|Two;u1.prop=42;//Type 'number' is not assignable to type 'string'.(2322)
I didn't include it in the playground, but behavior is the same for class or interface.
π Actual behavior
Assignment of number is flagged as an error, even though both sides of the union allow assignment of a number.
Activity