Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandrHoroshih committed Nov 18, 2023
1 parent 106acac commit 9bf2719
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/combine-events/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function combineEvents<P>({
reset,
target = createEvent(),
}: {
events: Events<P>;
events: Events<any>;
reset?: Unit<any>;
target?: UnitTargetable<any> | Unit<any>;
}) {
Expand Down Expand Up @@ -83,7 +83,7 @@ export function combineEvents<P>({

$counter.on($isDone, (value) => value - 1);
$results.on(events[key], (shape, payload) => {
const newShape = Array.isArray(shape) ? [...shape] : { ...shape };
const newShape = (Array.isArray(shape) ? [...shape] : { ...shape }) as any;
newShape[key] = payload;
return newShape;
});
Expand Down
22 changes: 12 additions & 10 deletions src/condition/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ export function condition<Params, Done, Fail>(options: {

export function condition<State>(options: {
if: ((payload: State) => boolean) | Store<boolean> | State;
then: Unit<NoInfer<State> | void>;
else: Unit<NoInfer<State> | void>;
then: UnitTargetable<NoInfer<State> | void>;
else: UnitTargetable<NoInfer<State> | void>;
}): EventAsReturnType<State>;
export function condition<State>(options: {
if: ((payload: State) => boolean) | Store<boolean> | State;
then: Unit<NoInfer<State> | void>;
then: UnitTargetable<NoInfer<State> | void>;
}): Event<State>;
export function condition<State>(options: {
if: ((payload: State) => boolean) | Store<boolean> | State;
else: Unit<NoInfer<State> | void>;
else: UnitTargetable<NoInfer<State> | void>;
}): Event<State>;
export function condition<State>({
if: test,
Expand All @@ -87,8 +87,8 @@ export function condition<State>({
}: {
if: ((payload: State) => boolean) | Store<boolean> | State;
source?: Store<State> | Event<State> | Effect<State, any, any>;
then?: Unit<State | void>;
else?: Unit<State | void>;
then?: UnitTargetable<State | void>;
else?: UnitTargetable<State | void>;
}) {
const checker =
is.unit(test) || isFunction(test) ? test : (value: State) => value === test;
Expand All @@ -98,24 +98,26 @@ export function condition<State>({
source,
match: {
then: checker,
else: inverse(checker),
else: inverse(checker as any),
},
cases: {
then: thenBranch,
else: elseBranch,
},
} as any);
} else if (thenBranch) {
// @ts-expect-error
sample({
source,
source: source,
filter: checker,
target: thenBranch as Unit<State>,
target: thenBranch,
});
} else if (elseBranch) {
// @ts-expect-error
sample({
source,
filter: inverse(checker as any),
target: elseBranch as Unit<State>,
target: elseBranch,
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/debug/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ function getType(unit: Unit<any> | Node) {
if (is.store(unit)) {
return 'store';
}
if (is.effect(unit) || isEffectChild(unit)) {
if (is.effect(unit as any) || isEffectChild(unit)) {
return 'effect';
}
if (is.event(unit)) {
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"strict": true,
"strictNullChecks": true,
"skipLibCheck": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es2016",
"types": ["jest", "node"]
},
Expand Down

0 comments on commit 9bf2719

Please sign in to comment.