简体   繁体   中英

TSLint: Unused var keyword

I've configured TSLint for my TypeScript project and I don't know what does the warning forbidden var keyword mean. Here is a minimal example, which results in the TSLint warning:

var x: number = 1;

Thank you.

Edit: I'm using the sample tslint.json .

It means you are not allowed to declare using var syntax

var = 1;

It's an Ecmascript 6 rule, it's purpose would be to ensure you don't accidentally re-declare the same variable twice in the same scope, giving it another meaning unintentionally.

See this page: http://eslint.org/docs/rules/no-var

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM