注意:只要变量的类型准确,则typeof获取变量的类型就不会错
enum Test {
a = "a0",
b = "b0"
}
// 这里的a是一个变量的值
let a: Test.a = "a0" as Test.a
// 这里的typeof a是一个类型【Test.a】
let x: typeof a = Test.a
注意:只要变量的类型准确,则typeof获取变量的类型就不会错
enum Test {
a = "a0",
b = "b0"
}
// 这里的a是一个变量的值
let a: Test.a = "a0" as Test.a
// 这里的typeof a是一个类型【Test.a】
let x: typeof a = Test.a