问题描述
假设我可以访问这样定义的类型Keys
:
type Keys = ('AA' | 'BB' | 'CC')[]
- 如何使用类型
Key
创建新类型Keys
,以使该新类型等于:
type Key = 'AA' | 'BB' | 'CC'
请注意,我无法从字面上指定允许的值(AA
,BB
等),我只能使用Keys
类型。
假设我可以访问这样定义的类型Keys
:
type Keys = ('AA' | 'BB' | 'CC')[]
Key
创建新类型Keys
,以使该新类型等于:type Key = 'AA' | 'BB' | 'CC'
请注意,我无法从字面上指定允许的值(AA
,BB
等),我只能使用Keys
类型。