Answers for "typescript assign two types"

0

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
};
Posted by: Guest on November-12-2020
0

typescript assign two types

// refered to as union types in typescript
interface Foo {
    bar:string|boolean;
}
Posted by: Guest on April-21-2021

Code answers related to "typescript assign two types"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language