2.0.5 • Published 6 months ago

@types/eseb__request-state v2.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/eseb__request-state

Summary

This package contains type definitions for @eseb/request-state (https://github.com/eseb/request-state#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/eseb__request-state.

index.d.ts

// Type definitions for @eseb/request-state 2.0
// Project: https://github.com/eseb/request-state#readme
// Definitions by: Ciarán Ingle <https://github.com/inglec-arista>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

export type State = 'FAILED' | 'IN_PROGRESS' | 'NOT_REQUESTED' | 'SUCCEEDED';

export default class RequestState<T = never> {
    readonly state: State;

    readonly attachment?: T | undefined;

    constructor(state?: State, attachment?: T);

    /** Does request have "FAILED" state? */
    isFailed(): boolean;
    /** Does request have "IN_PROGESS" state? */
    isInProgress(): boolean;
    /** Does request have "NOT_REQUESTED" state? */
    isNotRequested(): boolean;
    /** Does request have "SUCCEEDED" state? */
    isSucceeded(): boolean;
    /** Does the request have "NOT_REQUESTED" or "FAILED" state? */
    shouldBeRequested(): boolean;
    /** Does the request have "NOT_REQUESTED" or "IN_PROGESS" state? */
    shouldShowAsLoading(): boolean;
    /** Create a new `RequestState` instance with the same state and the passed attachment. */
    withAttachment<A>(attachment: A): RequestState<A>;
}

export const FAILED: RequestState;
export const IN_PROGRESS: RequestState;
export const NOT_REQUESTED: RequestState;
export const SUCCEEDED: RequestState;

Additional Details

  • Last updated: Thu, 08 Jul 2021 12:01:11 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Ciarán Ingle.

2.0.3

8 months ago

2.0.5

6 months ago

2.0.4

7 months ago

2.0.2

3 years ago

2.0.1

4 years ago

2.0.0

4 years ago