Skip to content
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

Missing implicit any error in destructuring with computed property #23334

Closed
ajafff opened this issue Apr 11, 2018 · 3 comments
Closed

Missing implicit any error in destructuring with computed property #23334

ajafff opened this issue Apr 11, 2018 · 3 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@ajafff
Copy link
Contributor

ajafff commented Apr 11, 2018

TypeScript Version: 2.9.0-dev.20180411

Search Terms:

Code

// --noImplicitAny
let named = 'foo';
let {[named]: prop} = {prop: 'foo'};

Expected behavior:
Element implicitly has an 'any' type because type '{ prop: string; }' has no index signature.

Actual behavior:
prop is any, but there is no implicit any error

Playground Link: https://agentcooper.github.io/typescript-play/#code/DYUwLgBAdghgtiAJhAvBA5AMwPbfQbgChRIBvAbVgUQF0AuCABwCdtGBfVCUlthrXOnb4gA

Related Issues:
#23297 (comment)

@mhegazy mhegazy added the Bug A bug in TypeScript label Apr 11, 2018
@mhegazy mhegazy added this to the TypeScript 2.9 milestone Apr 11, 2018
@weswigham
Copy link
Member

If named is const, we report the error as anticipated; so the issue here is simply that a computed property name of type string used to destructure something without an index signature to any should be an implicitAnyIndexError.

@mattmccutchen
Copy link
Contributor

mattmccutchen commented Apr 25, 2018

Duplicate of #20725 (or vice versa).

@mhegazy
Copy link
Contributor

mhegazy commented Apr 25, 2018

@mattmccutchen i think #20725 is a different issue, and should be fixed in 2.9.

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Apr 26, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants