diff --git a/vlib/v/gen/js/js.v b/vlib/v/gen/js/js.v index f4b8fcc605..6b35478450 100644 --- a/vlib/v/gen/js/js.v +++ b/vlib/v/gen/js/js.v @@ -872,8 +872,8 @@ fn (mut g JsGen) expr(node_ ast.Expr) { g.gen_array_init_expr(node) } ast.AsCast { - // skip: JS has no types, so no need to cast // TODO: Is jsdoc needed here for TS support? + g.expr(node.expr) } ast.Assoc { // TODO diff --git a/vlib/v/gen/js/tests/casting.v b/vlib/v/gen/js/tests/casting.v new file mode 100644 index 0000000000..838bead5f6 --- /dev/null +++ b/vlib/v/gen/js/tests/casting.v @@ -0,0 +1,6 @@ +type Type = string | bool + +fn main() { + t := Type('') + assert t is string && t == '' +}