Closed
Description
Bug Report
🔎 Search Terms
union, readonly, order
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about unioned readonly properties
Playground link with relevant code
💻 Code
🙁 Actual behavior
The order of the declaration of the variables one
and two
affects whether the compiler will treat the property a
as readonly. Also, the order of each variable in the conditional for the return type of doSomething
affects the inferred return type (i.e. whether a
is displayed as readonly or not)
Finally, when one
is first in the conditional, the displayed type of a
is any
🙂 Expected behavior
I would not expect the declaration order nor the conditional order to affect whether the property is considered readonly.