Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/effector/packages/effector/index.d.ts>restore

Business logic with ease ☄️
Latest
function restore
import { restore } from "https://deno.land/x/effector@effector-vue@23.1.0/packages/effector/index.d.ts";

Creates a Store out of successful results of Effect. It works like a shortcut for createStore(defaultState).on(effect.done, (_, {result}) => result)

Parameters

effect: Effect<any, Done, any>

source effect

defaultState: Done

initial state of new store

Creates a Store out of successful results of Effect. It works like a shortcut for createStore(defaultState).on(effect.done, (_, {result}) => result)

Parameters

effect: Effect<any, Done, any>

source effect

defaultState: null

initial state of new store

Creates a Store from Event. It works like a shortcut for createStore(defaultState).on(event, (_, payload) => payload)

Parameters

event: Event<E>

source event

defaultState: E

initial state of new store

Creates a Store from Event. It works like a shortcut for createStore(defaultState).on(event, (_, payload) => payload)

Parameters

event: Event<E>

source event

defaultState: null

initial state of new store

Type Parameters

T extends Event<any>

Returns

never

Type Parameters

T extends Effect<any, any, any>

Parameters

effect: T

Returns

never

Type Parameters

State extends { [key: string]: Store<any> | any; }

Returns

[K in keyof State]: State[K] extends Store<infer S> ? StoreWritable<S> : StoreWritable<State[K]>