如何合并联合文字类型

问题描述 投票:0回答:1

我有以下内容:

export type UHaem = 'haem.cbc' | 'haem.rbc'
export type UChem = 'chem.glucose' | 'chem.electrolytes'

如何将两者合并以获得最终类型,如下所示:

export type ULab = 'haem.cbc' | 'haem.rbc' | chem.glucose' | 'chem.electrolytes'
typescript union union-types
1个回答
0
投票

就这么简单:

export type ULab = UHaem | UChem;
© www.soinside.com 2019 - 2024. All rights reserved.