Skip to content

Commit

Permalink
Patronum v2.1.1 (#317)
Browse files Browse the repository at this point in the history
* fix(snapshot): make return value as StoreWritable (#308)

* Fix `status` type (#316)

---------

Co-authored-by: Aleksandr Grigorii <[email protected]>
  • Loading branch information
zerobias and domosedov authored Dec 15, 2023
1 parent d74cbd9 commit d76a3f6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/snapshot/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createStore, Effect, sample, Store, Unit, Event } from 'effector';
import { Effect, Event, Store, StoreWritable, Unit, createStore, sample } from 'effector';

type NoInfer<T> = [T][T extends any ? 0 : never];

Expand All @@ -10,7 +10,7 @@ export function snapshot<SourceType, TargetType = SourceType>({
source: Store<SourceType>;
clock?: Event<any> | Effect<any, any, any> | Store<any>;
fn?(value: SourceType): TargetType;
}): Store<NoInfer<TargetType>> {
}): StoreWritable<NoInfer<TargetType>> {
const defaultValue = fn(source.defaultState);
const onSnapshot = clock
? sample({ source, clock: clock as Unit<any>, fn })
Expand Down
6 changes: 3 additions & 3 deletions src/status/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { createStore, Effect, is, Store } from 'effector';
import { createStore, Effect, is, StoreWritable } from 'effector';

export type EffectState = 'initial' | 'pending' | 'done' | 'fail';

export function status<Params, Done, Fail = Error>(
effect: Effect<Params, Done, Fail>,
): Store<EffectState>;
): StoreWritable<EffectState>;
export function status<Params, Done, Fail = Error>(params: {
effect: Effect<Params, Done, Fail>;
defaultValue?: EffectState;
}): Store<EffectState>;
}): StoreWritable<EffectState>;
export function status<Params, Done, Fail = Error>(
params:
| {
Expand Down

0 comments on commit d76a3f6

Please sign in to comment.