union type property does not exist

Solutions on MaxInterview for union type property does not exist by the best coders in the world

showing results for - "union type property does not exist"
Kimberley
10 Aug 2016
1import { is } from 'typescript-is';
2
3...
4
5const getText = (obj: Obj1 | Obj2): string => {
6  if (is<Obj1>(obj)) {
7    return obj1.message;
8  }
9
10  return obj2.text;
11};
12