@types/react-copy-write
TypeScript icon, indicating that this package has built-in type declarations

0.7.7 • Public • Published

Installation

npm install --save @types/react-copy-write

Summary

This package contains type definitions for react-copy-write (https://github.com/aweary/react-copy-write).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-copy-write.

index.d.ts

import { Component, JSX } from "react";

// It'd be nice if this could somehow be improved! Perhaps we need variadic
// kinds plus infer keyword? Alternatively unions may solve our issue if we had
// the ability to restrict type widening.
type AnyDeepMemberOfState<T> = any;

type MutateFn<T> = (draft: T, state: Readonly<T>) => void;
type Mutator<T> = (mutator: MutateFn<T>) => void;

type SelectorFn<T> = (state: T) => AnyDeepMemberOfState<T>;

type RenderFn<T> = (...state: Array<Readonly<ReturnType<SelectorFn<T>>>>) => JSX.Element | JSX.Element[] | null;

interface ConsumerPropsBase<T> {
    select?: Array<SelectorFn<T>> | undefined;
}

interface ConsumerPropsExplicitRender<T> extends ConsumerPropsBase<T> {
    render?: RenderFn<T> | undefined;
}

interface ConsumerPropsImplicitRender<T> extends ConsumerPropsBase<T> {
    children?: RenderFn<T> | undefined;
}

type ConsumerProps<T> = ConsumerPropsExplicitRender<T> | ConsumerPropsImplicitRender<T>;

declare class Consumer<T> extends Component<ConsumerProps<T>> {}

interface ProviderProps<T> {
    children: JSX.Element | JSX.Element[];
    initialState?: Partial<T> | undefined;
}

declare class Provider<T> extends Component<ProviderProps<T>> {}

declare function create<T extends object>(state: T): {
    Provider: new() => Provider<T>;
    Consumer: new() => Consumer<T>;
    createSelector: SelectorFn<T>;
    mutate: Mutator<T>;
};

export default create;

Additional Details

  • Last updated: Mon, 11 Dec 2023 12:43:52 GMT
  • Dependencies: @types/react

Credits

These definitions were written by Sam A. Horvath-Hunt, and Dave Jeffery .

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.7.10ts2.8
0.7.10ts2.9
0.7.10ts3.0
0.7.10ts3.1
0.7.10ts3.2
0.7.10ts3.3
0.7.10ts3.4
0.7.10ts3.5
0.7.21ts3.6
0.7.21ts3.7
0.7.21ts3.8
0.7.21ts3.9
0.7.21ts4.0
0.7.21ts4.1
0.7.21ts4.2
0.7.21ts4.3
0.7.21ts4.4
0.7.50ts4.5
0.7.72ts5.8
0.7.72ts5.7
0.7.72latest
0.7.72ts4.6
0.7.72ts4.7
0.7.72ts4.8
0.7.72ts4.9
0.7.72ts5.0
0.7.72ts5.1
0.7.72ts5.2
0.7.72ts5.3
0.7.72ts5.4
0.7.72ts5.5
0.7.72ts5.6
0.7.72ts5.9

Version History

VersionDownloads (Last 7 Days)Published
0.7.72
0.7.60
0.7.50
0.7.40
0.7.30
0.7.21
0.7.10
0.7.00

Package Sidebar

Install

npm i @types/react-copy-write

Weekly Downloads

1

Version

0.7.7

License

MIT

Unpacked Size

5.73 kB

Total Files

5

Last publish

Collaborators

  • types