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
Expected behavior:
The id property should not be visible when iterating the keys and the value should be 1 when logged in the constructor and 2 when logged after the value is changed.
Actual behavior:
The id property is indeed not visible when iterating the keys but the value is undefined when logged on both occurrences.
Expected behavior:
The id property should not be visible when iterating the keys and the value should be 1 when logged in the constructor and 2 when logged after the value is changed.
Actual behavior:
The id property is visible when iterating the keys. The value is 1 when logged in the constructor and 2 when logged after it's changed.
Expected behavior:
The id property should not be visible when iterating the keys and the value should be 1 when logged in the constructor and 2 when logged after the value is changed.
Actual behavior:
The id property is not visible when iterating the keys and the value is 1 when logged in the constructor and 2 when logged after the value is changed.
The text was updated successfully, but these errors were encountered:
JonWallsten
changed the title
Settings enumerable: false within a property decorator does not work as expected
Setting enumerable: false within a property decorator does not work as expected
Feb 20, 2018
@aluanhaddad Yeah, I can tell as much by looking at the code and it might be expected technically due to the implementation, but for me as a developer it's really not. So the questions remains, is this the intended behavior, or a current limitation?
This behaves per spec. it is worth noting that the current Decorator ES spec has moved away from this design, and TS will need to implement the new proposal.
TypeScript Version: 2.7.1-insiders.20180127 (TypeScript Playground)
Search Terms:
typescript decorator descriptor enumerable writable defineProperty instance
Code
Example 1
Setting enumerable: false with a decorator
Expected behavior:
The id property should not be visible when iterating the keys and the value should be 1 when logged in the constructor and 2 when logged after the value is changed.
Actual behavior:
The id property is indeed not visible when iterating the keys but the value is undefined when logged on both occurrences.
Playground Link:
https://goo.gl/oh9PH1
Second example
Setting enumerable: false and writable: true with a decorator
Expected behavior:
The id property should not be visible when iterating the keys and the value should be 1 when logged in the constructor and 2 when logged after the value is changed.
Actual behavior:
The id property is visible when iterating the keys. The value is 1 when logged in the constructor and 2 when logged after it's changed.
Playground Link:
https://goo.gl/8L662Q
Third example (works as expected)
Setting enumerable: false and writable: true within the constructor
Expected behavior:
The id property should not be visible when iterating the keys and the value should be 1 when logged in the constructor and 2 when logged after the value is changed.
Actual behavior:
The id property is not visible when iterating the keys and the value is 1 when logged in the constructor and 2 when logged after the value is changed.
Playground Link:
https://goo.gl/kFvycX
The text was updated successfully, but these errors were encountered: