Sarà dattiloscritto assegnazioni destrutturazione di supporto?

voti
5

Sarà dattiloscritto assegnazioni destrutturazione di supporto simili a CoffeeScript?

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

 # which will yield
 x == 1 && z == 3
È pubblicato 02/10/2012 alle 08:53
fonte dall'utente
In altre lingue...                            


2 risposte

voti
5

Si lo farà.

Vedere questo problema nella loro bug tracker: http://typescript.codeplex.com/workitem/15

UPDATE: Questo è ora supportato.

Risposto il 06/10/2012 a 22:42
fonte dall'utente

voti
0

Già ora sostiene dal ES6 in poi. È possibile verificare il codice nel browser (che supporta ES6) consolarsi, come di seguito.

const user = {name: 'Robkuz', gender: 'Male', looks: 'Great'}
const {name, looks} = user;
Risposto il 17/09/2018 a 17:07
fonte dall'utente

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more