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'?

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

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

猜你喜欢

转载自blog.csdn.net/LlanyW/article/details/130216747