
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
@types/react-request
Advanced tools
TypeScript definitions for react-request
npm install --save @types/react-request
This package contains type definitions for react-request (https://github.com/jamesplease/react-request).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-request.
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>> {}
These definitions were written by Danny Cochran, Angus Fretwell, Jonathan Ly, and Alberto Juan.
FAQs
TypeScript definitions for react-request
We found that @types/react-request demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.