Module

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

Business logic with ease ☄️
Latest
function attach
import { attach } from "https://dotland.deno.dev/x/effector@effector-vue%4023.1.0/packages/effector/index.d.ts";

Method for creating state-dependent effect and transforming effect payloads

Type Parameters

Params
States extends StoreShape
FX extends Effect<any, any, any>

Parameters

config: { source: States; effect: FX; mapParams: (params: Params, states: GetShapeValue<States>) => NoInfer<EffectParams<FX>>; name?: string; }

Method for transforming effect payloads

Type Parameters

FN extends ((params: any) => any)
FX extends Effect<any, any, any>

Parameters

config: { effect: FX; mapParams: FN extends (...args: any[]) => NoInfer<EffectParams<FX>> ? FN : never; name?: string; }

Returns

FN extends (...args: infer Args) => NoInfer<EffectParams<FX>> ? Effect<Args["length"] extends 0 ? void : 0 | 1 extends Args["length"] ? Args[0] | void : Args[0], EffectResult<FX>, EffectError<FX>> : never

new effect

Method for transforming effect payloads

Type Parameters

Params
FX extends Effect<any, any, any>

Parameters

config: { effect: FX; mapParams: (params: Params) => NoInfer<EffectParams<FX>>; name?: string; }

Method for passing state values to effects

Type Parameters

States extends StoreShape
FX extends Effect<GetShapeValue<States>, any, any>

Parameters

config: { source: States; effect: FX; name?: string; }

Creates state-dependent effect with provided function handler. Allows the one to omit intermediate effects and declare effect handler right next to data source

Type Parameters

States extends StoreShape
FX extends (state: GetShapeValue<States>, params: any) => any

Parameters

config: { source: States; effect: FX; domain?: Domain; name?: string; }

Returns

FX extends (source: any, ...args: infer Args) => infer Done ? Effect<OptionalParams<Args>, Awaited<Done>> : never

new effect

Creates independent instance of given effect. Used to add subscribers to effect call in a particular business case

Type Parameters

FX extends Effect<any, any, any>

Parameters

config: { effect: FX; name?: string; }

Returns

new effect linked to given one

Method for creating state-dependent effect and transforming effect payload

Type Parameters

States extends StoreShape
FX extends Effect<any, any, any>
FN extends ((params: any, source: GetShapeValue<States>) => NoInfer<EffectParams<FX>>)

Parameters

config: { source: States; effect: FX; mapParams: FN; name?: string; }

Returns

Effect<Parameters<FN>[0], EffectResult<FX>, EffectError<FX>>

new effect