Skip to content

Add support for destructuring well-known and late-bound names #23297

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

Merged
merged 2 commits into from
Apr 11, 2018

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