Bu sahifa hali tarjima qilinmagan

Tarjima qoshish uchun havola boyicha o'tib Pull Request oching (havolaga o'tish).

Standart til uchun tarkibni ko'rsatadi.

Effector provides several utility types to facilitate getting a type of value from the unit.

UnitValue<Type>

Taking out of Unit value type.

Example

import { createEffect, createStore, createEvent, fork, UnitValue } from "effector";

const event = createEvent<{ id: string; name?: string } | { id: string }>();
const $store = createStore([false, true]);
const effect = createEffect<{ token: string }, any, string>(() => {});
const scope = fork();

type UnitEventType = UnitValue<typeof event>;
// {id: string; name?: string | undefined} | {id: string}

type UnitStoreType = UnitValue<typeof store>;
// boolean[]

type UnitEffectType = UnitValue<typeof effect>;
// {token: string}

type UnitScopeType = UnitValue<typeof scope>;
// any

StoreValue<Type>

Taking out of Store value type.

Example

import { createStore, StoreValue } from "effector";

const $store = createStore(true);

type StoreValueType = StoreValue<typeof $store>;
// boolean

EventPayload<Type>

Taking out of Event payload type.

Example

import { createEvent, EventPayload } from "effector";

const event = createEvent<{ id: string }>();

type EventPayloadType = EventPayload<typeof event>;
// {id: string}

EffectParams<Type>

Taking out of Effect params type.

Example

import { createEffect, EffectParams } from "effector";

const fx = createEffect<
  { id: string },
  { name: string; isAdmin: boolean },
  { statusText: string; status: number }
>(() => ({ name: "Alice", isAdmin: false }));

type EffectParamsType = EffectParams<typeof fx>;
// {id: string}

EffectResult<Type>

Taking out of Effect result type.

Example

import { createEffect, EffectResult } from "effector";

const fx = createEffect<
  { id: string },
  { name: string; isAdmin: boolean },
  { statusText: string; status: number }
>(() => ({ name: "Alice", isAdmin: false }));

type EffectResultType = EffectResult<typeof fx>;
// {name: string; isAdmin: boolean}

EffectError<Type>

Taking out of Effect error type.

Example

import { createEffect, EffectError } from "effector";

const fx = createEffect<
  { id: string },
  { name: string; isAdmin: boolean },
  { statusText: string; status: number }
>(() => ({ name: "Alice", isAdmin: false }));

type EffectErrorType = EffectError<typeof fx>;
// {statusText: string; status: number}
Tarjima jamiyat tomonidan qollanilyapti

Ingliz tilidagi hujjatlar eng dolzarb hisoblanadi, chunki u effector guruhi tomonidan yozilgan va yangilanadi. Hujjatlarni boshqa tillarga tarjima qilish jamiyat tomonidan kuch va istaklar mavjud bo'lganda amalga oshiriladi.

Esda tutingki, tarjima qilingan maqolalar yangilanmasligi mumkin, shuning uchun eng aniq va dolzarb ma'lumot uchun hujjatlarning asl inglizcha versiyasidan foydalanishni tavsiya etamiz.

Hammualliflar