Type alias ResponsePromise

ResponsePromise: {
    arrayBuffer: (() => Promise<ArrayBuffer>);
    blob: (() => Promise<Blob>);
    formData: (() => Promise<FormData>);
    json: (<T>() => Promise<T>);
    text: (() => Promise<string>);
} & Promise<KyResponse>

Type declaration

  • arrayBuffer: (() => Promise<ArrayBuffer>)
      • (): Promise<ArrayBuffer>
      • Returns Promise<ArrayBuffer>

  • blob: (() => Promise<Blob>)
      • (): Promise<Blob>
      • Returns Promise<Blob>

  • formData: (() => Promise<FormData>)
      • (): Promise<FormData>
      • Returns Promise<FormData>

  • json: (<T>() => Promise<T>)

    Get the response body as JSON.

    Example

    import ky from 'ky';

    const json = await ky(…).json();

    Example

    import ky from 'ky';

    interface Result {
    value: number;
    }

    const result = await ky(…).json<Result>();
      • <T>(): Promise<T>
      • Type Parameters

        • T = unknown

        Returns Promise<T>

  • text: (() => Promise<string>)
      • (): Promise<string>
      • Returns Promise<string>

Generated using TypeDoc