【发布时间】:2020-03-27 07:25:17
【问题描述】:
我是 angular 和 typescript 的新手,遇到了这个错误
TS2339:“从不”类型上不存在属性“长度”。
它出现在“name.length”的此代码片段中,我希望该函数仅在字符串“name”的长度大于或等于 3 个字符时才起作用。
processForm() {
if(name.length>=3){
const allInfo = `My name is ${this.name}....`;
alert(allInfo);
}
}
【问题讨论】:
-
代码中有用户
never?
标签: angular typescript