Typescript interface: Only one record per index

Asked

Viewed 32 times

0

How to create an interface capable of only logging 1:1 in the IAgendaConfig through the attribute IAgendaDia.diaSemana (Prevent if there is no day of the week or if there is a duplicate on IAgendaConfig). There can only be one per day of the week.

    interface IAgendaDia {
      diaSemana:
        | 'sunday'
        | 'monday'
        | 'tuesday'
        | 'wednesday'
        | 'thursday'
        | 'friday'
        | 'saturday';
      ativo: boolean;
      inicioExp: string;
      terminoExp: string;
      inicioInt: string;
      terminoInt: string;
    }
    
    interface IAgendaConfig {
      AgendaDia: IAgendaDia[];
    }
  • I believe your question was not very clear!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.