diff --git a/packages/core/src/runtime/actor.ts b/packages/core/src/runtime/actor.ts index 4d82298..1c2913b 100644 --- a/packages/core/src/runtime/actor.ts +++ b/packages/core/src/runtime/actor.ts @@ -80,7 +80,10 @@ export function toRef(_v: any): Ref | undefined { return isRef(_v) ? _v : void 0; } -export function assertionFrom(a: Assertable): Assertion { +export function assertionFrom(a: Assertable): Assertion; +export function assertionFrom(a: Assertable | undefined): Assertion | undefined; +export function assertionFrom(a: Assertable | undefined): Assertion | undefined { + if (a === void 0) return void 0; if (typeof a === 'object' && '__as_preserve__' in a) { return fromJS(a); } else { @@ -464,6 +467,7 @@ export class Turn { let assertion: Assertable | undefined = void 0; this.dataflow(() => { let {target: nextTarget, assertion: nextAssertion} = assertionFunction(); + nextAssertion = assertionFrom(nextAssertion); if (target !== nextTarget || !is(assertion, nextAssertion)) { target = nextTarget; assertion = nextAssertion;