Skip to content

Destructuring assignments are producing errors with noImplicitAny #8229

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

Closed
thebanjomatic opened this issue Apr 20, 2016 · 3 comments
Closed
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@thebanjomatic
Copy link

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.

@mhegazy mhegazy added the Bug A bug in TypeScript label Apr 20, 2016
@mhegazy mhegazy added this to the TypeScript 2.0 milestone Apr 20, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Apr 20, 2016

looks like a regression from #6935

@thebanjomatic
Copy link
Author

@sheetalkamat Any update on this issue? I came across the problem again when trying to build my code-base with the 2.0 beta.

@AlexGalays
Copy link

This bug is going to be encountered fairly frequently using TS 2.0 beta

@mhegazy mhegazy modified the milestones: TypeScript 2.0.1, TypeScript 2.1 Aug 17, 2016
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Aug 18, 2016
yuit added a commit that referenced this issue Aug 20, 2016
* Add test case for #8229

* Do not report errors during contextual typecheck
Fixes #8229

* Handle the scenario when let [a=undefined]=[]

* Don't allow `.ts` to appear in an import

* Add specific error message for unwanted '.ts' extension

* Allow `await` in a simple unary expression

* More tests

* Forbid `await await`

* Allow `await await`

* Improve error message

* Don't allow ".d.ts" extension in an import either.

* Rename 'find' functions

* Move supportedTypescriptExtensionsWithDtsFirst next to supportedTypeScriptExtensions and rename

* Fix comment

* Treat special property access symbol differently
... when retriving documentation

* Fix tests

* Update shim version to be 2.1 (#10424)

* Check return code paths on getters (#10102)

* Check return paths on getters

* Remove TODO comment

* Remove extraneous arguments from harness's runBaseline (#10419)

* Remove extraneous arguments from runBaseline

* Address comments from @yuit

* Remove needless call to basename

* Refactor baseliners out of compiler runner (#10440)

* CR feedback

* fix broken tests

* Pass in baselineOpts into types baselines so that RWC baselines can be written to internal folder (#10443)
yuit added a commit that referenced this issue Aug 23, 2016
* Add test case for #8229

* Do not report errors during contextual typecheck
Fixes #8229

* Handle the scenario when let [a=undefined]=[]

* Instantiate contextual this parameters if needed

* Test that contextually typed generic this parameters are instantiated

* Don't allow `.ts` to appear in an import

* Add specific error message for unwanted '.ts' extension

* Allow `await` in a simple unary expression

* More tests

* Forbid `await await`

* Allow `await await`

* Improve error message

* Don't allow ".d.ts" extension in an import either.

* Rename 'find' functions

* Assign and instantiate contextual this type if not present

* JSDoc supports null, undefined and never types

* Update baselines in jsDocParsing unit tests

* Return non-JsDocComment children
... to make syntactic classification work

* Move supportedTypescriptExtensionsWithDtsFirst next to supportedTypeScriptExtensions and rename

* Fix comment

* Treat special property access symbol differently
... when retriving documentation

* Fix tests

* Update shim version to be 2.1 (#10424)

* Check return code paths on getters (#10102)

* Check return paths on getters

* Remove TODO comment

* Remove extraneous arguments from harness's runBaseline (#10419)

* Remove extraneous arguments from runBaseline

* Address comments from @yuit

* Remove needless call to basename

* Refactor baseliners out of compiler runner (#10440)

* CR feedback

* fix broken tests

* Pass in baselineOpts into types baselines so that RWC baselines can be written to internal folder (#10443)

* Add more test for 10426

* routine update of dom libs

* Add test for jsdoc syntactic classification for function declaration

* Simplify implementation

* Tolerate certain errors in tsconfig.json

* Add test for configFile error tolerance

* Use TS parser to tolerate more errors in tsconfig.json

* Implement tuple types as type references to synthesized generic types

* Add comments + minor changes

* Accept new baselines

* Add .types extension

* Properly guard for undefined in getTypeReferenceArity

* Add jsdoc nullable union test case to fourslash

* Fix class/interface merging issue + lint error

* Allow "typings" in a package.json to be missing its extension (but also allow it to have an extension)

* Contextually type this in getDeclFromSig, not checkThisExpr

* Update parser comment with es7 grammar (#10459)

* Use ES7 term of ExponentiationExpression

* Update timeout for mac OS

* Address PR: add space

* allowSyntheticDefaultImports resolves to modules instead of variables

Fixes #10429 by improving the fix in #10096

* Rename getContextuallyTypedThisParameter to getContextualThisParameter

* Fix 10472: Invalid emitted code for await expression (#10483)

* Properly emit await expression with yield expression

* Add tests and update baselines

* Move parsing await expression into parse unary-expression

* Update incorrect comment
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 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