Skip to content

Commit

Permalink
Fix issue with isBehavior return true for arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
limemloh committed Sep 4, 2021
1 parent 96a3bf2 commit a96b01c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/behavior.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function refresh<A>(b: Behavior<A>, t: number) {

export function isBehavior<A>(b: unknown): b is Behavior<A> {
return (
(typeof b === "object" && "at" in b && !isPlaceholder(b)) ||
(typeof b === "object" && "at" in b && "pull" in b && !isPlaceholder(b)) ||
(isPlaceholder(b) && (b.source === undefined || isBehavior(b.source)))
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { tick } from "./clock";
export type Time = number;

function isBehavior(b: unknown): b is Behavior<unknown> {
return typeof b === "object" && "at" in b;
return typeof b === "object" && "at" in b && "pull" in b;
}

export type PullHandler = (pull: (t?: number) => void) => () => void;
Expand Down

0 comments on commit a96b01c

Please sign in to comment.