【发布时间】:2017-02-13 18:11:06
【问题描述】:
我正在使用 TSlint (v3.15.1) 和更新版本的 typescript (2.0.3) 更新旧的 .ts 文件。我遇到了一些我想解决的错误。
代码是对某些类属性的简单存在性测试:
export class myClass {
private pUserName: string;
private pUserPass: string;
private pHost: string;
private pPort: number;
constructor($host: string, $port: number) {
this.pHost = $host;
this.pPort = $port;
}
public isReady(): boolean {
return Boolean(this.pUserName && this.pUserPass && this.pJiraHost && this.pJiraPort);
}
要么我得到一个“[ts] 找不到名称布尔值”,要么是一些“无法将字符串转换为布尔值”......
我是打字稿的新手,你能帮我写一下正确的方法吗?
【问题讨论】:
标签: typescript tslint