[英]Export a union type alias in typescript
Is it possible to export something like this: 是否可以导出这样的东西:
export TypeA | TypeB as TypeAB;
and declare a variable of TypeAB
that can be either of TypeA
or TypeB
: 并声明
TypeAB
的变量,可以是TypeA
或TypeB
:
import {TypeAB} from './typeab';
var ab: TypeAB;
是的,只需要类型别名的正确语法:
export type TypeAB = TypeA | TypeB;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.