less than 1 minute read

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

Tags:

Categories:

Updated:

Leave a comment