mt-flowbite-react
Version:
Official React components built for Flowbite and Tailwind CSS
18 lines (17 loc) • 659 B
TypeScript
/**
* Middleware that changes the store type
*
*/
import { State, StateCreator, StoreMutatorIdentifier } from 'zustand';
type Foo = <T extends State, A, Mps extends [StoreMutatorIdentifier, unknown][] = [], Mcs extends [StoreMutatorIdentifier, unknown][] = []>(f: StateCreator<T, [...Mps, ['foo', A]], Mcs>, bar: A) => StateCreator<T, Mps, [['foo', A], ...Mcs]>;
declare module 'zustand' {
interface StoreMutators<S, A> {
foo: Write<Cast<S, object>, {
foo: A;
}>;
}
}
export declare const foo: Foo;
type Write<T extends object, U extends object> = Omit<T, keyof U> & U;
type Cast<T, U> = T extends U ? T : U;
export {};