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
let{[Symbol.iterator]: destructured}=[];// destructured is anyletelementAccess=[][Symbol.iterator];// elementAccess is type () => IterableIterator<never>declarefunctionget<T>(): T;let{[get<'prop'>()]: computed}=get<{prop: string}>();// computed is anylet{ prop }=get<{prop: string}>();// prop is string
Expected behavior: destructured has the same type as elementAccess; computed has the same type as prop.
Actual behavior:
Destructuring with computed property always results in any.
TypeScript Version: 2.9.0-dev.20180407
Search Terms: destructuring computed
Code
Expected behavior:
destructured
has the same type aselementAccess
;computed
has the same type asprop
.Actual behavior:
Destructuring with computed property always results in
any
.Playground Link: http://www.typescriptlang.org/play/#src=let%20%7B%20%5BSymbol.iterator%5D%3A%20destructured%20%7D%20%3D%20%5B%5D%3B%0Alet%20elementAccess%20%3D%20%5B%5D%5BSymbol.iterator%5D%3B%0A%0Adeclare%20function%20get%3CT%3E()%3A%20T%3B%0A%0Alet%20%7B%20%5Bget%3C'prop'%3E()%5D%3A%20computed%20%7D%20%3D%20get%3C%7B%20prop%3A%20string%20%7D%3E()%3B%0Alet%20%7B%20prop%20%7D%20%3D%20get%3C%7B%20prop%3A%20string%20%7D%3E()%3B
Related Issues:
#17566 but that one is only about index signatures
The text was updated successfully, but these errors were encountered: