Skip to content

chore: add an utils class and a method to create a type that's enum available entries

Mathias Gorenflot requested to merge feat/utils into master

Ajout d'une méthode permettant de déclarer les valeurs possibles pour une entrée. Exemple :

export const Status = Utils.strEnum(['DNS', 'ERROR', 'IN_PROGRESS', 'READY']);
export type Status = keyof typeof Status;

Usage :

export default interface ReportResponse {
  host: string;
  port: number;
  protocol: string;
  isPublic: boolean;
  status: Status;
  statusMessage: string;
  startTime: string;
  testTime: string;
  engineVersion: string;
  criteriaVersion: string;
  endpoints: EndPointInterface[];
}

if (report.status === Status.ERROR) { ... }

Merge request reports