Simplify evaluateWord type

This commit is contained in:
Tangent Wantwight 2023-10-20 17:47:51 -04:00
parent de4495a997
commit e2f00d3e5b

View file

@ -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<Context = {}> = {
function evaluateWord<Context>(
state: Vm<Context>,
word: Word | InterpolatedPiece
): TextWord | BareWord | HtmlWord {
): TextPiece {
if ("bare" in word || "text" in word || "html" in word) {
return word;
} else if ("variable" in word) {