From 52ea7d1cfcced7e03fb5e4f951012b1e112f9251 Mon Sep 17 00:00:00 2001 From: Harry Solovay Date: Tue, 9 Aug 2022 15:47:06 +0800 Subject: [PATCH] fix: effect run result type (#182) --- effect/sys/Atom.ts | 5 ++--- effect/sys/run.ts | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/effect/sys/Atom.ts b/effect/sys/Atom.ts index b1d1ef298..d15081d18 100644 --- a/effect/sys/Atom.ts +++ b/effect/sys/Atom.ts @@ -1,7 +1,6 @@ import { E_, Effect, Resolved, T_, ValCollection } from "./Effect.ts"; import { key } from "./key.ts"; -import { RunContext } from "./run.ts"; -import { run } from "./run.ts"; +import { run, RunContext, RunResult } from "./run.ts"; export function atom( fqn: N, @@ -24,7 +23,7 @@ export class Atom super(fqn); } - run() { + run(): RunResult { return run(this); } } diff --git a/effect/sys/run.ts b/effect/sys/run.ts index 1d6c246c8..785ad7fd6 100644 --- a/effect/sys/run.ts +++ b/effect/sys/run.ts @@ -6,8 +6,8 @@ import { key } from "./key.ts"; export interface RunContext { run: Run; } - -export type Run = (root: Root) => Promise | E_>; +export type RunResult = Promise | E_>; +export type Run = (root: Root) => RunResult; export const { run } = (new class Runtime implements RunContext { #cache = new Map>(); // TODO: set max size / use LRU