【发布时间】:2022-07-05 23:32:28
【问题描述】:
是否可以定义一个字符串类型的变量,然后定义该字符串可以有哪些可能的值?
colorScheme?: string = 'positive|negative'; //must be a string
and must have the value "postiive" or "negative"
谢谢。
【问题讨论】:
-
colorScheme?: 'positive' | 'negative = ...'
标签: angular typescript assign