import type { Component } from 'solid-js'; import { SetStoreFunction as SetStateFunction, Store as State } from 'solid-js/store'; declare type BaseObject = Record; declare type Effect = () => unknown | Promise; interface StateFn { (props: Props): StateResult | Promise; } declare type ThenArg = T extends PromiseLike ? U : T; /** * @param options - A function An object describing your store * @returns [Provider, useProvider] - A tuple Provider/useProvider * * @example * ```tsx * const [Provider, useProvider] = createStore({ * state: () => ({ count: 0 }), * * actions: (set) => ({ * increment = (by = 1) => set('count', c => c + by) * }) * }) * * const App = () => { * const [store, { increment }] = useStore() * * return * } * * const app = createApp(App) * app.use(Provider) * app.mount('#app') * ``` */ export declare function createStore({ state, actions, props, effects, }: { state: StateFn; actions?: ReturnType> extends Promise ? (set: SetStateFunction>>, get: State>>, props: Props) => Actions : (set: SetStateFunction, get: State, props: Props) => Actions; props?: Props; effects?: ReturnType> extends Promise ? (set: SetStateFunction>>, get: State>>, props: Props) => Effect[] : (set: SetStateFunction, get: State, props: Props) => Effect[]; }): readonly [Component>, () => readonly [State, Readonly & { readonly set: SetStateFunction; }]]; export {};