How to declare a new type from the trade unions?

Suppose I find that I am declaring many things as Foo|Bar|Baz , and I get tired of writing this. How can I declare type Foob = Foo|Bar|Baz so that I can use Foob ?

+5
source share
1 answer

Just the way you typed.

 type Foo = {}; type Bar = {}; type Ba = {}; declare type Foob = Foo|Bar|Ba; let x:Foob; 
+8
source

Source: https://habr.com/ru/post/1247098/


All Articles