Simplify evaluateWord type
This commit is contained in:
parent
de4495a997
commit
e2f00d3e5b
1 changed files with 12 additions and 3 deletions
15
src/vm.ts
15
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<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) {
|
||||
|
|
Loading…
Reference in a new issue