typescript merge object with interface code example
Example: merge two types typescript
interface IStudent {
id: string;
age: number;
}
interface IWorker {
companyId: string;
}
type IStudentAlias = IStudent;
type ICustomType = IStudent | IWorker;
let s: IStudentAlias = {
id: 'ID3241',
age: 2
};