user219438
user219438

Reputation:

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.

Upvotes: 3

Views: 3869

Answers (1)

Andreas Turku
Andreas Turku

Reputation: 413

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

Upvotes: 8

Related Questions