Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions crates/oxc_codegen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2098,7 +2098,7 @@ impl<'a, const MINIFY: bool> GenExpr<MINIFY> for TSAsExpression<'a> {
fn gen_expr(&self, p: &mut Codegen<{ MINIFY }>, precedence: Precedence, ctx: Context) {
p.print_char(b'(');
p.print_char(b'(');
self.expression.gen_expr(p, precedence, ctx);
self.expression.gen_expr(p, precedence, Context::default());
p.print_char(b')');
p.print_str(" as ");
self.type_annotation.gen(p, ctx);
Expand All @@ -2108,8 +2108,13 @@ impl<'a, const MINIFY: bool> GenExpr<MINIFY> for TSAsExpression<'a> {

impl<'a, const MINIFY: bool> GenExpr<MINIFY> for TSSatisfiesExpression<'a> {
fn gen_expr(&self, p: &mut Codegen<{ MINIFY }>, precedence: Precedence, ctx: Context) {
// TODO: print properly
self.expression.gen_expr(p, precedence, ctx);
p.print_char(b'(');
p.print_char(b'(');
self.expression.gen_expr(p, precedence, Context::default());
p.print_char(b')');
p.print_str(" satisfies ");
self.type_annotation.gen(p, ctx);
p.print_char(b')');
}
}

Expand All @@ -2127,8 +2132,11 @@ impl<'a, const MINIFY: bool> GenExpr<MINIFY> for TSNonNullExpression<'a> {

impl<'a, const MINIFY: bool> GenExpr<MINIFY> for TSInstantiationExpression<'a> {
fn gen_expr(&self, p: &mut Codegen<{ MINIFY }>, precedence: Precedence, ctx: Context) {
// TODO: print properly
self.expression.gen_expr(p, precedence, ctx);
self.type_parameters.gen(p, ctx);
if MINIFY {
p.print_hard_space();
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/oxc_codegen/tests/integration/snapshots/ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ b = (x as y);
b = ((x) as y);

c = foo<string>;
c = foo;
c = foo<string>;

d = x satisfies y;
d = x;
d = ((x) satisfies y);