mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
feat(codegen): print TSImport remaining fields (#3695)
```ts
type A = import("./a", { with: { "type": "json"}}).Name<T>
```
This commit is contained in:
parent
a94a72dc68
commit
4a004e2140
1 changed files with 37 additions and 0 deletions
|
|
@ -3028,7 +3028,44 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for TSImportType<'a> {
|
|||
fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) {
|
||||
p.print_str(b"import(");
|
||||
self.argument.gen(p, ctx);
|
||||
if let Some(attributes) = &self.attributes {
|
||||
p.print_str(", ");
|
||||
attributes.gen(p, ctx);
|
||||
}
|
||||
p.print_str(b")");
|
||||
if let Some(qualifier) = &self.qualifier {
|
||||
p.print(b'.');
|
||||
qualifier.gen(p, ctx);
|
||||
}
|
||||
if let Some(type_parameters) = &self.type_parameters {
|
||||
type_parameters.gen(p, ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, const MINIFY: bool> Gen<MINIFY> for TSImportAttributes<'a> {
|
||||
fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) {
|
||||
// { with: { ... } }
|
||||
p.print_str(b"{ with: { ");
|
||||
p.print_list(&self.elements, ctx);
|
||||
p.print_str(b" }}");
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, const MINIFY: bool> Gen<MINIFY> for TSImportAttribute<'a> {
|
||||
fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) {
|
||||
self.name.gen(p, ctx);
|
||||
p.print_str(": ");
|
||||
self.value.gen_expr(p, Precedence::Member, ctx);
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, const MINIFY: bool> Gen<MINIFY> for TSImportAttributeName<'a> {
|
||||
fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) {
|
||||
match self {
|
||||
TSImportAttributeName::Identifier(ident) => ident.gen(p, ctx),
|
||||
TSImportAttributeName::StringLiteral(literal) => literal.gen(p, ctx),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue