mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(codegen): missing const keyword in TSTypeParamter (#4022)
close: #4017
This commit is contained in:
parent
243c9f35b0
commit
7844734856
2 changed files with 4 additions and 0 deletions
|
|
@ -2994,6 +2994,9 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for TSLiteral<'a> {
|
|||
|
||||
impl<'a, const MINIFY: bool> Gen<MINIFY> for TSTypeParameter<'a> {
|
||||
fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) {
|
||||
if self.r#const {
|
||||
p.print_str(b"const ");
|
||||
}
|
||||
self.name.gen(p, ctx);
|
||||
if let Some(constraint) = &self.constraint {
|
||||
p.print_str(b" extends ");
|
||||
|
|
|
|||
|
|
@ -200,6 +200,7 @@ fn typescript() {
|
|||
false,
|
||||
);
|
||||
test_ts("let foo: { <T>(t: T): void }", "let foo: {<T>(t: T): void};\n", false);
|
||||
test_ts("function <const T>(){}", "function<const T>() {}\n", false);
|
||||
}
|
||||
|
||||
fn test_comment_helper(source_text: &str, expected: &str) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue