source: imaps-frontend/node_modules/react-use/lib/useAsyncFn.d.ts

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 881 bytes
RevLine 
[d565449]1import { DependencyList } from 'react';
2import { FunctionReturningPromise, PromiseType } from './misc/types';
3export declare type AsyncState<T> = {
4 loading: boolean;
5 error?: undefined;
6 value?: undefined;
7} | {
8 loading: true;
9 error?: Error | undefined;
10 value?: T;
11} | {
12 loading: false;
13 error: Error;
14 value?: undefined;
15} | {
16 loading: false;
17 error?: undefined;
18 value: T;
19};
20declare type StateFromFunctionReturningPromise<T extends FunctionReturningPromise> = AsyncState<PromiseType<ReturnType<T>>>;
21export declare type AsyncFnReturn<T extends FunctionReturningPromise = FunctionReturningPromise> = [
22 StateFromFunctionReturningPromise<T>,
23 T
24];
25export default function useAsyncFn<T extends FunctionReturningPromise>(fn: T, deps?: DependencyList, initialState?: StateFromFunctionReturningPromise<T>): AsyncFnReturn<T>;
26export {};
Note: See TracBrowser for help on using the repository browser.