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
Add downlevel and typing support for const enum members in computed properties #1844
There are two things we can do by taking advantage of our static knowledge of const enums. One is that we can downlevel this without using an element access:
varv={0: ""};
Another is that we can know the type of v. Specifically, we know that it has a property named 0 of type string, which we would not know if this were not a const enum member.
It is useful if you do not care about what number the name evaluates to, and you just want to think of the property as being keyed by the enum member itself, much like a property keyed by a symbol.
Activity
RyanCavanaugh commentedon May 4, 2015
Not terribly useful with numeric names. We should revisit this when we have string-based enums, where this would be more useful
JsonFreeman commentedon May 4, 2015
It is useful if you do not care about what number the name evaluates to, and you just want to think of the property as being keyed by the enum member itself, much like a property keyed by a symbol.
danquirk commentedon May 5, 2015
Tagging #1206 so we actually can maybe revisit this