@types/react-request
Advanced tools
+43
-21
| // Type definitions for react-request 3.1 | ||
| // Project: https://github.com/jamesplease/react-request | ||
| // Definitions by: Danny Cochran <https://github.com/dannycochran> | ||
| // Angus Fretwell <https://github.com/angusfretwell> | ||
| // Jonathan Ly <https://github.com/jonathanly> | ||
| // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -9,39 +11,59 @@ // TypeScript Version: 2.9 | ||
| export interface RenderProps<T> { | ||
| requestName: string; | ||
| requestKey: string; | ||
| fetching: boolean; | ||
| failed: boolean; | ||
| error: Error | null; | ||
| response: Response | null; | ||
| url: string; | ||
| data: T | null; | ||
| doFetch: (options?: FetchRequestProps) => Promise<void>; | ||
| 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; | ||
| url: string; | ||
| lazy?: boolean; | ||
| url: string; | ||
| } | ||
| export interface FetchProps<T = any> extends FetchRequestProps { | ||
| children?: (renderProps: RenderProps<T>) => React.ReactNode; | ||
| afterFetch?: (args: FetchResponse<T>) => void; | ||
| transformData?: (data: any) => T; | ||
| children?: (renderProps: RenderProps<T>) => React.ReactNode; | ||
| } | ||
| export interface DoFetchOptions extends RequestInit { | ||
| url?: string; | ||
| } | ||
| 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; | ||
| method?: string; | ||
| responseType?: string; | ||
| body?: string; | ||
| url?: string; | ||
| method?: string; | ||
| responseType?: string; | ||
| body?: string; | ||
| } | ||
| export interface ProxyRequest { | ||
| requestKey: string; | ||
| res: Response; | ||
| requestKey: string; | ||
| res: Response; | ||
| } | ||
| // TODO(dannycochran) Fill out fetchDedupe options. | ||
| export function fetchDedupe(input: any, init?: any, dedupeOptions?: any): Promise<ProxyRequest>; | ||
| export function fetchDedupe( | ||
| input: any, | ||
| init?: any, | ||
| dedupeOptions?: any | ||
| ): Promise<ProxyRequest>; | ||
| export function getRequestKey(keyOptions?: RequestKeyOptions): string; | ||
@@ -52,2 +74,2 @@ export function isRequestInFlight(): boolean; | ||
| export class Fetch<T = any> extends React.Component<FetchProps<T>> { } | ||
| export class Fetch<T = any> extends React.Component<FetchProps<T>> {} |
| { | ||
| "name": "@types/react-request", | ||
| "version": "3.1.1", | ||
| "version": "3.1.2", | ||
| "description": "TypeScript definitions for react-request", | ||
@@ -11,2 +11,12 @@ "license": "MIT", | ||
| "githubUsername": "dannycochran" | ||
| }, | ||
| { | ||
| "name": "Angus Fretwell", | ||
| "url": "https://github.com/angusfretwell", | ||
| "githubUsername": "angusfretwell" | ||
| }, | ||
| { | ||
| "name": "Jonathan Ly", | ||
| "url": "https://github.com/jonathanly", | ||
| "githubUsername": "jonathanly" | ||
| } | ||
@@ -25,4 +35,4 @@ ], | ||
| }, | ||
| "typesPublisherContentHash": "2c5b32da9efd645e70059d41a83a8c94e0e7e7a1a4d5e4f47b6587188178b2a7", | ||
| "typesPublisherContentHash": "78da09abe66e9652f4f7b808e53ba8a52a50ef0fed91adc95b37feb88c251718", | ||
| "typeScriptVersion": "2.9" | ||
| } |
@@ -11,3 +11,3 @@ # Installation | ||
| Additional Details | ||
| * Last updated: Wed, 06 Mar 2019 16:11:30 GMT | ||
| * Last updated: Wed, 03 Apr 2019 01:41:07 GMT | ||
| * Dependencies: @types/react | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
| # Credits | ||
| These definitions were written by Danny Cochran <https://github.com/dannycochran>. | ||
| These definitions were written by Danny Cochran <https://github.com/dannycochran>, Angus Fretwell <https://github.com/angusfretwell>, Jonathan Ly <https://github.com/jonathanly>. |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
4966
22.62%61
41.86%