字符串字面量类型
xcatliu opened this issue · 7 comments
Mryang119 commented
坐个沙发
ChieseBluceLee commented
像枚举
barry1102 commented
坐个板凳
Shyng commented
不一定要字符串吧,Number类型也可以啊:
type Nums = 1 | 2 | 3;
JackyM06 commented
事实上不一定要字符串,任意基础类型都是可以的
huanshiwushuang commented
感觉 类似联合,联合 是类型的限制;type 是值的限制
huanshiwushuang commented
那么请问,这和 枚举有什么区别嘛??? 感觉枚举也是 取值的限制啊??