Skip to content

Conversation

@weswigham
Copy link
Member

Fixes #23257

@ajafff
Copy link
Contributor

ajafff commented Apr 10, 2018

I guess there will now be an error if the late bound computed property is not present in the destructured object?

declare function get<T>(): T;

let { [get<'foo'>()]: computed } = get<{ bar: string }>(); // error: property 'foo' does not exist in type '{bar: string}'?

Maybe add a test for that case?

Btw.: why is there no implicit any error if the computed property name is not a literal type and the destructured type has no index signature? Using element access there is an implicit any error with --noImplicitAny.

@weswigham weswigham merged commit b2e0c4b into microsoft:master Apr 11, 2018
@weswigham weswigham deleted the destructuring-late-bound-name branch April 11, 2018 01:21
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants