CristhGunners - Desarrollador de Software

Cristhofer Andana

Desarrollador de Software

Usar union type en Typescript

ts

octubre 20, 2022
type HttpMethod = "GET" | "POST" | "PATCH" | "DELETE";

function example(method: HttpMethod, url: string): void {
  console.log(`${method}: ${url}`);
}