Uh oh!
There was an error while loading. Please reload this page.
Unions and intersections of readonly properties are now also readonly - #9167
Conversation
| // Unions and intersections of the above | ||
| if (symbol.flags & SymbolFlags.SyntheticProperty) { | ||
| return forEach(symbol.declarations, decl => isReadonlySymbol(getSymbolOfNode(decl))); | ||
| } |
There was a problem hiding this comment.
This could probably be more efficient. When a symbol has multiple declarations (such as an overloaded method) we'll end up doing the same check multiple times even though the outcome is always false. Ideally we'd have a SymbolFlags.Readonly that we compute in the same way as SymbolFlags.Optional, but we're out of flag bits. Perhaps it would be better to compute the readonly state in createUnionOrIntersectionProperty (by calling isReadonlySymbol for each underlying symbol) and then record the result in an isReadonly property on the symbol itself.
There was a problem hiding this comment.
That sounds like a good idea. Done.
Anders Hejlsberg (@ahejlsberg) can you take a look at the updated code? |
Mohamed Hegazy (mhegazy)
commented
Jun 24, 2016
👍 |
Fixes#9108
Anders Hejlsberg (@ahejlsberg) can you take a look to confirm that this is how readonly should work with unions and intersections of properties?