5

Will Typescript support destructuring assignments similar to CoffeeScript?

 foo = {x: 1, y: 2, z: 3}
 {x, z} = foo

 # which will yield
 x == 1 && z == 3
1
  • Since TypeScript 1.5 this is now supported. Commented Sep 19, 2015 at 6:02

2 Answers 2

5

Yes, it will.

See this issue in their bug tracker: http://typescript.codeplex.com/workitem/15

UPDATE: This is now supported.

Sign up to request clarification or add additional context in comments.

Comments

0

Yeah it now support from ES6 onwards. You can test the code in your browser(which supports ES6) console itself as below.

const user = {name: 'Robkuz', gender: 'Male', looks: 'Great'}
const {name, looks} = user;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.