TSLint: Unused var keyword

六眼飞鱼酱① 提交于 2019-12-24 03:26:29

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!