2
我现在有两个字符串数组,并包含相同字符串的字符串字面联合类型:打字稿数组字符串字面型
const furniture = ['chair', 'table', 'lamp'];
type Furniture = 'chair' | 'table' | 'lamp';
我都在我的应用程序所需要的,但我想保持我的代码干。那么有什么办法可以从另一个方面推断出来吗?
我基本上想说一些像type Furniture = [any string in furniture array]
这样的东西,所以没有重复的字符串。