Skip to content

Commit 9f5b9ed

Browse files
committed
remove unnecessary type narrowing
1 parent 5f122da commit 9f5b9ed

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/translator/adjective.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,21 @@ function so(emphasis: null | TokiPona.Emphasis) {
2323
}
2424
}
2525
}
26-
// TODO: is {type: "simple"} necessary here?
2726
export function adjective(
2827
options: Readonly<{
2928
definition: Dictionary.Adjective;
3029
reduplicationCount: number;
3130
emphasis: null | TokiPona.Emphasis;
3231
}>,
33-
): IterableResult<English.AdjectivePhrase & { type: "simple" }> {
32+
): IterableResult<English.AdjectivePhrase> {
3433
const { definition, reduplicationCount, emphasis } = options;
3534
type EmphasisSo = Readonly<{ emphasis: boolean; so: null | string }>;
3635
return IterableResult.concat(
3736
IterableResult.from(() => IterableResult.single(so(emphasis)))
3837
.map((so): EmphasisSo => ({ emphasis: false, so })),
3938
IterableResult.single<EmphasisSo>({ emphasis: emphasis != null, so: null }),
4039
)
41-
.map(({ emphasis, so }): English.AdjectivePhrase & { type: "simple" } => ({
40+
.map(({ emphasis, so }): English.AdjectivePhrase => ({
4241
type: "simple",
4342
kind: definition.kind,
4443
adverbs: [
@@ -60,14 +59,13 @@ export function adjective(
6059
emphasis: false,
6160
}));
6261
}
63-
// TODO: is {type: "compound"} necessary here?
6462
export function compoundAdjective(
6563
options: Readonly<{
6664
adjectives: ReadonlyArray<Dictionary.Adjective>;
6765
reduplicationCount: number;
6866
emphasis: null | TokiPona.Emphasis;
6967
}>,
70-
): IterableResult<English.AdjectivePhrase & { type: "compound" }> {
68+
): IterableResult<English.AdjectivePhrase> {
7169
const { adjectives, reduplicationCount, emphasis } = options;
7270
if (reduplicationCount === 1) {
7371
return IterableResult.combine(
@@ -76,7 +74,7 @@ export function compoundAdjective(
7674
adjective({ definition, reduplicationCount: 1, emphasis })
7775
),
7876
)
79-
.map((adjectives): English.AdjectivePhrase & { type: "compound" } => ({
77+
.map((adjectives): English.AdjectivePhrase => ({
8078
type: "compound",
8179
conjunction: "and",
8280
adjectives,

0 commit comments

Comments
 (0)