0.2.3 • Published 7 months ago

@types/fragmented-store v0.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Installation

npm install --save @types/fragmented-store

Summary

This package contains type definitions for fragmented-store (https://github.com/aralroca/fragmented-store).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fragmented-store.

index.d.ts

// Type definitions for fragmented-store 0.2
// Project: https://github.com/aralroca/fragmented-store
// Definitions by: Lunuy <https://github.com/lunuy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Minimum TypeScript Version: 4.1

import {
    Dispatch,
    SetStateAction,
    ReactNode,
    ExoticComponent
} from 'react';

type StateHook<S> = () => [S, Dispatch<SetStateAction<S>>];

type StoreUtils<Store extends { [K: string]: any }> = Omit<{
    [K in keyof Store as `use${Capitalize<string & K>}`]: StateHook<Store[K]>
}, 'useStore'> & {
    Provider: ExoticComponent<{ children: ReactNode }>,
    useStore: StateHook<Store>
};

declare function createStore<Store extends { [K: string]: any }>(store: Store): StoreUtils<Store>;

export = createStore;

Additional Details

  • Last updated: Thu, 30 Sep 2021 08:01:18 GMT
  • Dependencies: @types/react
  • Global values: none

Credits

These definitions were written by Lunuy.