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
Should getters still infer the same type from setters over their return expressions? #43414
Should the get type of myValue be Promise<string> or just string | Promise<string>? Right now it is the latter; but technically, the former provides a more specific type.
Changing this technically would be a breaking change.
Activity
MartinJohns commentedon Mar 29, 2021
Related: #2521 / #42425.
Personally I would keep it as is, and allow users to opt-in to the new behavior with an explicit type annotation.
ahejlsberg commentedon Mar 29, 2021
I agree, I don't think there is a compelling case for us to infer divergent getter and setter types.
RyanCavanaugh commentedon Mar 29, 2021
I also would prefer to keep the current behavior
DanielRosenwasser commentedon Mar 30, 2021
Consensus'd