Skip to content

Commit ebfe7e3

Browse files
committed
improve type assertion
1 parent abbd6c3 commit ebfe7e3

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/translator/modifier.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { ExhaustedError, TranslationTodoError } from "./error.ts";
99
import { nanpa } from "./nanpa.ts";
1010
import { noun } from "./noun.ts";
1111
import { number, numberAsText } from "./number.ts";
12-
import { phrase } from "./phrase.ts";
12+
import { phrase, PhraseTranslation } from "./phrase.ts";
1313
import { pronoun } from "./pronoun.ts";
1414
import { noEmphasis, word } from "./word.ts";
1515
import { getReduplicationCount } from "./word_unit.ts";
@@ -146,7 +146,9 @@ function defaultModifier(wordUnit: TokiPona.WordUnit) {
146146
}
147147
}
148148
}
149-
function pi(insidePhrase: TokiPona.Phrase) {
149+
function pi(
150+
insidePhrase: TokiPona.Phrase,
151+
): IterableResult<ModifierTranslation> {
150152
return phrase({
151153
phrase: insidePhrase,
152154
place: "object",
@@ -159,7 +161,9 @@ function pi(insidePhrase: TokiPona.Phrase) {
159161
)
160162
.filter((modifier) =>
161163
modifier.type !== "adjective" || modifier.inWayPhrase == null
162-
) as IterableResult<ModifierTranslation>;
164+
) as IterableResult<
165+
PhraseTranslation & { type: Exclude<PhraseTranslation["type"], "verb"> }
166+
>;
163167
}
164168
function modifier(modifier: TokiPona.Modifier) {
165169
switch (modifier.type) {

0 commit comments

Comments
 (0)