问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/32413050/tslint-unused-var-keyword