@types/redux-optimistic-ui
TypeScript icon, indicating that this package has built-in type declarations

0.4.14 • Public • Published

Installation

npm install --save @types/redux-optimistic-ui

Summary

This package contains type definitions for redux-optimistic-ui (https://github.com/mattkrick/redux-optimistic-ui).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/redux-optimistic-ui.

index.d.ts

/// <reference types="redux" />

declare module "redux-optimistic-ui" {
    import { Reducer } from "redux";

    /**
     * Enhanced state by redux-optimistic-ui
     */
    export interface OptimisticState<TState> {
        /**
         * History list
         * List is Immutable.List<>
         */
        history: any;
        /**
         * Before state
         */
        beforeState: TState;
        /**
         * Current state
         */
        current: TState;
    }

    /**
     * Enhances and wraps your root reducer into optimistic state
     */
    export function optimistic<TState>(reducer: Reducer<TState>): Reducer<OptimisticState<TState>>;

    /**
     * Returns your current state or state if it wasn't enhanced yet
     */
    export function ensureState<TState>(state: OptimisticState<TState> | TState): TState;

    /**
     * Optimistic action slice
     */
    export interface OptimisticAction {
        meta: {
            /**
             * Optimistic information
             */
            optimistic: {
                /**
                 * Type, BEGIN, COMMIT or REVERT
                 */
                type: string;
                /**
                 * Transaction id. Id should be unique for each optimistic action
                 */
                id: number;
            };
        };
    }

    /**
     * Start optimistic action
     */
    export const BEGIN = "@@optimist/BEGIN";
    /**
     * Finish optimistic action and commit results
     */
    export const COMMIT = "@@optimist/COMMIT";
    /**
     * Revert optimistic action
     */
    export const REVERT = "@@optimist/REVERT";
}

Additional Details

  • Last updated: Tue, 07 Nov 2023 15:11:36 GMT
  • Dependencies: redux

Credits

These definitions were written by Alexey Svetliakov.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/redux-optimistic-ui

Weekly Downloads

344

Version

0.4.14

License

MIT

Unpacked Size

6 kB

Total Files

5

Last publish

Collaborators

  • types