From e2f00d3e5b228bd531df1e44375041c739e6389f Mon Sep 17 00:00:00 2001 From: Tangent Wantwight Date: Fri, 20 Oct 2023 17:47:51 -0400 Subject: [PATCH] Simplify evaluateWord type --- src/vm.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/vm.ts b/src/vm.ts index e0b122e..9221955 100644 --- a/src/vm.ts +++ b/src/vm.ts @@ -1,6 +1,15 @@ import { - AsHtml, AsText, BareWord, Concat, HtmlWord, InterpolatedPiece, Script, TextPiece, TextWord, Word -} from './words'; + AsHtml, + AsText, + BareWord, + Concat, + HtmlWord, + InterpolatedPiece, + Script, + TextPiece, + TextWord, + Word, +} from "./words"; /** * "Mode" of the environment a script runs in; determines access to mutability features and such. @@ -31,7 +40,7 @@ export type Vm = { function evaluateWord( state: Vm, word: Word | InterpolatedPiece -): TextWord | BareWord | HtmlWord { +): TextPiece { if ("bare" in word || "text" in word || "html" in word) { return word; } else if ("variable" in word) {