New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@types/react-request

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/react-request

TypeScript definitions for react-request

ts4.5
ts4.6
ts4.7
ts4.8
ts4.9
ts5.0
ts5.1
ts5.2
ts5.3
ts5.4
ts5.5
ts5.6
ts5.7
ts5.8
ts5.9
ts6.0
latest
Source
npmnpm
Version
3.1.7
Version published
Maintainers
1
Created
Source

Installation

npm install --save @types/react-request

Summary

This package contains type definitions for react-request (https://github.com/jamesplease/react-request).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-request.

index.d.ts

import * as React from "react";

export interface FetchResponse<T> {
    url: string;
    init: any;
    failed: boolean;
    requestKey: string;
    response: Response | null;
    data: T | null;
    error: Error | null;
    didUnmount: boolean;
}

export interface RenderProps<T> extends FetchResponse<T> {
    requestName: string;
    fetching: boolean;
    doFetch: DoFetch<T>;
}

export interface FetchRequestProps extends RequestInit {
    lazy?: boolean | undefined;
    url: string;
}

export type ResponseType = "arrayBuffer" | "blob" | "formData" | "json" | "text";

export interface FetchProps<T = any> extends FetchRequestProps {
    afterFetch?: ((args: FetchResponse<T>) => void) | undefined;
    transformData?: ((data: any) => T) | undefined;
    responseType?: ResponseType | undefined;
    children?: ((renderProps: RenderProps<T>) => React.ReactNode) | undefined;
}

export interface DoFetchOptions extends RequestInit {
    url?: string | undefined;
}

export type DoFetch<T = any> = (
    options?: DoFetchOptions,
) => Promise<FetchResponse<T>>;

// TODO(dannycochran) RequestKeyOptions, ProxyRequest, fetchDedupe, getRequestKey, isRequestInFlight, clearRequestCache
// should all be defined in an adjacent typings directory for fetch-dedupe.
export interface RequestKeyOptions {
    url?: string | undefined;
    method?: string | undefined;
    responseType?: string | undefined;
    body?: string | undefined;
}

export interface ProxyRequest {
    requestKey: string;
    res: Response;
}

// TODO(dannycochran) Fill out fetchDedupe options.
export function fetchDedupe(
    input: any,
    init?: any,
    dedupeOptions?: any,
): Promise<ProxyRequest>;

export function getRequestKey(keyOptions?: RequestKeyOptions): string;
export function isRequestInFlight(): boolean;
export function clearRequestCache(): void;
export function clearResponseCache(): void;

export class Fetch<T = any> extends React.Component<FetchProps<T>> {}

Additional Details

  • Last updated: Tue, 07 Nov 2023 09:09:39 GMT
  • Dependencies: @types/react

Credits

These definitions were written by Danny Cochran, Angus Fretwell, Jonathan Ly, and Alberto Juan.

FAQs

Package last updated on 07 Nov 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts