let result: number | string; result = 10; // OK result = 'Hi'; // also OK result = false; // a boolean value, not OK
위 처럼 union type으로 변수가 여러개의 type중 하나를 가질 수 있게됨.
union type으로 변수에 하나 이상의 tpye을 지정할 수 있음.
출처