1.字面量类型用来约束取值是某几个字面量中的一个
2.字面量类型和类型别名一样也是用type定义,但含义不同,是对值的限制
type
type fruit = 'apple' | 'banana' | 'orange' let hasEat:fruit = 'watermelon' //报错,约束为定义的三种