Type Alias Statuses

Statuses: {
    code: Record<string, number | undefined>;
    codes: number[];
    empty: Record<number, boolean | undefined>;
    message: Record<number, string | undefined>;
    redirect: Record<number, boolean | undefined>;
    retry: Record<number, boolean | undefined>;
    (code: string | number): string | number;
}

The type definitions for the statuses library.

While the library has type definitions, TypeScript throws an error that they can't be exported, so that's why they are copied in there.

Type declaration

    • (code): string | number
    • Given a status code, returns the status text, and given a status text, returns the status code.

      Parameters

      • code: string | number

        The status code or status text to look up.

      Returns string | number

      If the status is invalid.

  • code: Record<string, number | undefined>

    A dictionary with the status texts and their corresponding status codes.

  • codes: number[]

    A list of all the supported status codes.

  • empty: Record<number, boolean | undefined>

    A dictionary with the status codes and their corresponding status texts, for responses that expect an empty body.

  • message: Record<number, string | undefined>

    A dictionary with the status codes and their corresponding status texts.

  • redirect: Record<number, boolean | undefined>

    A dictionary with status codes for responses that are valid for redirections.

  • retry: Record<number, boolean | undefined>

    A dictionary with status codes that should be retried.