Typescript: Binding element 'any' implicitly has an 'any' type.

Created on 13 Jul 2016  路  4Comments  路  Source: microsoft/TypeScript

TypeScript Version: Version 2.1.0-dev.20160712

Code

function test({a:any}) {

}

Expected behavior:
Should compile with --noImplicitAny (compiles fine with 1.8.0)

Actual behavior:
error TS7031: Binding element 'any' implicitly has an 'any' type.

Question

Most helpful comment

this is not a type annotation, this is a rename for the destructured propeortes. Please see http://www.typescriptlang.org/docs/handbook/variable-declarations.html#property-renaming

what you want is:

function test({a} : { a: any}) {

}

All 4 comments

this is not a type annotation, this is a rename for the destructured propeortes. Please see http://www.typescriptlang.org/docs/handbook/variable-declarations.html#property-renaming

what you want is:

function test({a} : { a: any}) {

}

Shouldn't it be bug for 1.8 then ?

Shouldn't it be bug for 1.8 then ?

I am sure there was one logged, could not find it. it should be fixed in latest typescript@next as well as [email protected]

I feel like a stronger error message should be emitted here. I don't think many people will easily find this.

Was this page helpful?
1 / 5 - 1 ratings