TypeScript
TypeScript 是一种给 JavaScript 添加特性的语言扩展,支持es6,是微软提出的一种编程语言,TypeScript 设计目标是开发大型应用,它可以编译成纯 JavaScript,编译出来的 JavaScript 可以运行在任何浏览器上。
安装
npm install -g typescript
报错语句 | 解决方法 |
---|---|
Declaration of public static field not allowed after declaration of public instance method. Instead, this should come at the beginning of the class/interface. (member-ordering)tslint(1) | 把defaultProps和state移动至最前面即可: |
Shadowed name: ‘id’ (no-shadowed-variable)tslint(1) | 似乎不能用id命名,改其他命名即可 |
Class name must be in pascal case (class-name)tslint(1) | 接口名应采用大驼峰的写法:CityItem |
– | – |
Identifier ‘tempOpt’ is never reassigned; use ‘const’ instead of ‘let’. (prefer-const)tslint(1) | 把let换成const即可 |
Multiline JSX elements must be wrapped in parentheses (jsx-wrap-multiline)tslint(1) | 多行JSX元素必须用括号括起来 |
– | – |