Skip to content

Destructuring assignments are producing errors with noImplicitAny #8229

Closed
@thebanjomatic

Description

@thebanjomatic

I found an issue in the current nightly builds relating to destructuring assignments with noImplicitAny enabled. The actual code was more complicated, but it can be simplified to the following:

let [a, b, c] = [1, 2, 3];

The variables appear to be typed correctly on hover, however, 3 errors are produced inside the assignment stating that a, b, and c have an implicit type of any.

It can be silenced by the following, but that's not ideal:

let [a, b, c] = <[number, number, number]>[1, 2, 3];

TypeScript Version:

Searching backwards, it first appears in:

  • nightly (1.9.0-dev.20160409)

Expected behavior:

There shouldn't be an implicit any error in this case.

Actual behavior:

An erroneous error is produced.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions