myType‘ refers to a value, but is being used as a type here. Did you mean ‘typeof myType‘?

 自定义类型时,如下代码红色报错:myType' refers to a value, but is being used as a type here. Did you mean 'typeof myType'?

myType‘ refers to a value, but is being used as a type here. Did you mean ‘typeof myType‘?_第1张图片

 找了一会才发现类型定义用let关键字:

let myType = 1 | 3 | 5 | 7;
改成 type myType=1|3|5|7

 

你可能感兴趣的:(typescript)