From b9079354fb004fa8078a051b1cabafc4f637a37f Mon Sep 17 00:00:00 2001 From: Simon Friis Vindum <simonfv@gmail.com> Date: Sat, 24 Aug 2019 07:17:59 +0200 Subject: [PATCH] Rename properties in result type --- src/component.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/component.ts b/src/component.ts index 9f4db12..a42eca4 100644 --- a/src/component.ts +++ b/src/component.ts @@ -88,7 +88,7 @@ export abstract class Component<A, O> implements Monad<O> { } } result<R>(o: R): Result<R, O> { - return { output: o, child: this }; + return { available: o, child: this }; } view(): Component<O, {}> { return view(this); @@ -259,7 +259,7 @@ const placeholderProxyHandler = { } }; -type Result<R, O> = { output: R; child: Child<O> }; +type Result<R, O> = { available: R; child: Child<O> }; function isLoopResult(r: any): r is Result<any, any> { return typeof r === "object" && "child" in r; @@ -289,9 +289,9 @@ class LoopComponent<L, O> extends Component<O, {}> { } const res = this.f(placeholderObject); const result = Now.is(res) ? runNow<Child<L> | Result<O, L>>(res) : res; - const { output, child } = isLoopResult(result) + const { available, child } = isLoopResult(result) ? result - : { output: {} as O, child: result }; + : { available: {} as O, child: result }; const { output: looped } = toComponent(child).run(parent, destroyed); const needed = Object.keys(placeholderObject); for (const name of needed) { @@ -303,7 +303,7 @@ class LoopComponent<L, O> extends Component<O, {}> { } placeholderObject[name].replaceWith(looped[name]); } - return { available: output, output: {} }; + return { available, output: {} }; } }