-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for object literal property value shorthand #418
Comments
👍 |
If ES6 is doing this then we'll certainly align with that. If it doesn't make it into ES6 then we'd almost assuredly have to wait for a future ES version lest we create incompatible syntax. |
👍 With this feature this code:
could be written like this:
In my codebase this feature would very useful, because I'm often creating "smaller" object from "bigger" one, so for loop on "smaller" object enumerates just the properties I need. |
@mpawelski I do not think this is what is proposed for ES6. the ES6 proposal is just for identifier names and not for dotted names. |
You can use destructuring with object literal property value: var bigObject = {
A: "1",
B: "2",
C: "3"
};
var {A,B} = bigObject,
smallObject = {A,B}; 🚨 untested code |
Started here: https://typescript.codeplex.com/workitem/1367
Please consider adding support for object literal property value shorthand, as per the ES6 proposal: http://wiki.ecmascript.org/doku.php?id=harmony:object_literals#object_literal_property_value_shorthand. This would allow for the following:
The text was updated successfully, but these errors were encountered: