If you want to combine multiple types in TypeScript
You can use Intersection Types.
Just combine the types with &.
If you don’t really need to declare the type multiple times,
type BroadcastDisplay = {
no: number;
title: string;
startAt: string;
endAt: string;
state: BroadcastState;
HOME: boolean;
SCHEDULE_TABLE: boolean;
TOP_MAIN_CARD: boolean;
};
type DisplayRowProps = BroadcastDisplay & {
testType: ({no, type, value}: DisplayToggleValueType) => void;
};
you can do it like this.
20211223
Leave a comment