mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +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> {
|
impl<'a, const MINIFY: bool> Gen<MINIFY> for TSTypeParameter<'a> {
|
||||||
fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) {
|
fn gen(&self, p: &mut Codegen<{ MINIFY }>, ctx: Context) {
|
||||||
|
if self.r#const {
|
||||||
|
p.print_str(b"const ");
|
||||||
|
}
|
||||||
self.name.gen(p, ctx);
|
self.name.gen(p, ctx);
|
||||||
if let Some(constraint) = &self.constraint {
|
if let Some(constraint) = &self.constraint {
|
||||||
p.print_str(b" extends ");
|
p.print_str(b" extends ");
|
||||||
|
|
|
||||||
|
|
@ -200,6 +200,7 @@ fn typescript() {
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
test_ts("let foo: { <T>(t: T): void }", "let foo: {<T>(t: T): void};\n", 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) {
|
fn test_comment_helper(source_text: &str, expected: &str) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue