Skip to content

Commit

Permalink
fix(snapshot): make return value as StoreWritable (#308)
Browse files Browse the repository at this point in the history
  • Loading branch information
domosedov authored Dec 15, 2023
1 parent d74cbd9 commit b503166
Showing 1 changed file with 2 additions and 2 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

0 comments on commit b503166

Please sign in to comment.