Skip to content

Commit

Permalink
feat: print TSTypeAliasDeclaration
Browse files Browse the repository at this point in the history
  • Loading branch information
Dunqing committed Jun 14, 2024
1 parent 7353716 commit 905b2d3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions crates/oxc_codegen/src/gen_ts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,22 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for TSModuleDeclaration<'a> {
}
}

impl<'a, const MINIFY: bool> Gen<MINIFY> for TSTypeAliasDeclaration<'a> {
fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) {
if !p.options.enable_typescript {
return;
}
p.print_str(b"type ");
self.id.gen(p, ctx);
if let Some(type_parameters) = &self.type_parameters {
type_parameters.gen(p, ctx);
}
p.print_str(b" = ");
self.type_annotation.gen(p, ctx);
p.print_semicolon_after_statement();
}
}

impl<'a, const MINIFY: bool> Gen<MINIFY> for TSInterfaceDeclaration<'a> {
fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) {
if !p.options.enable_typescript {
Expand Down

0 comments on commit 905b2d3

Please sign in to comment.