Skip to content

Commit 43322bd

Browse files
alexisthedevtheosotr
authored andcommitted
Fix union type handling of literal types
1 parent f075f3a commit 43322bd

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/ir/typescript_types.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,9 @@ def __init__(self, max_ut, max_in_union):
426426
NumberType(),
427427
BooleanType(),
428428
StringType(),
429-
ArrayType(),
430429
NullType(),
431430
UndefinedType(primitive=False),
432-
literal_types.get_literal_types(),
433-
]
431+
] + literal_types.get_literal_types()
434432
self.max_in_union = (max_in_union if max_in_union <= len(self.candidates)
435433
else len(self.candidates))
436434

src/translators/typescript.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ def get_incorrect_filename():
7878
return TypeScriptTranslator.incorrect_filename
7979

8080
def get_union(self, utype):
81-
union = " | ".join([self.type_arg2str(t) for t in utype.types])
82-
return union
81+
return " | ".join([self.type_arg2str(t) for t in utype.types])
8382

8483
def type_arg2str(self, t_arg):
8584
# TypeScript does not have a Wildcard type

0 commit comments

Comments
 (0)