union type property does not exist code example
Example: union type property does not exist
import { is } from 'typescript-is';
...
const getText = (obj: Obj1 | Obj2): string => {
if (is(obj)) {
return obj1.message;
}
return obj2.text;
};