import { JsonProperty , Serializable } from '../../src' ; import { Gender } from './gender' ; import { Human } from './human' ; import { PhoneNumber } from './phone-number' ; @ Serializable ( ) export class Employee extends Human { /** The employee's email */ @ JsonProperty ( { required : true } ) email : string ; @ JsonProperty ( { predicate : property => { if ( property && property . value !== undefined ) { return PhoneNumber ; } } } ) phoneNumber : PhoneNumber | string ; constructor ( public name , @ JsonProperty ( 'employeeId' ) public id , public gender , public birthDate ) { super ( name , id , gender , birthDate ) ; } }