TSLint: Unused var keyword
Asked Answered
H

1

3

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.

Haematozoon answered 5/9, 2015 at 12:28 Comment(0)
S
8

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

Stuff answered 5/9, 2015 at 12:46 Comment(1)
Just to make it more obvious, you can instead use let x... or const x.. instead of var x...Dogged

© 2022 - 2024 — McMap. All rights reserved.