diff --git a/src/behavior.ts b/src/behavior.ts index c566388..82674af 100644 --- a/src/behavior.ts +++ b/src/behavior.ts @@ -139,7 +139,7 @@ function refresh(b: Behavior, t: number) { export function isBehavior(b: unknown): b is Behavior { 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))) ); } diff --git a/src/common.ts b/src/common.ts index 072f087..4a98753 100644 --- a/src/common.ts +++ b/src/common.ts @@ -5,7 +5,7 @@ import { tick } from "./clock"; export type Time = number; function isBehavior(b: unknown): b is Behavior { - 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;