Skip to content

Commit

Permalink
fix(codegen): print type parameters for MethodDefinition (#3922)
Browse files Browse the repository at this point in the history
close: #3918
  • Loading branch information
Dunqing committed Jun 26, 2024
1 parent 27f0531 commit 2766594
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions crates/oxc_codegen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2410,6 +2410,9 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for MethodDefinition<'a> {
if self.computed {
p.print(b']');
}
if let Some(type_parameters) = self.value.type_parameters.as_ref() {
type_parameters.gen(p, ctx);
}
p.print(b'(');
self.value.params.gen(p, ctx);
p.print(b')');
Expand Down
4 changes: 3 additions & 1 deletion crates/oxc_isolated_declarations/tests/fixtures/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ export class Foo {

export class Bar {
public constructor(a: number = 0) {}
}
}

export class Zoo { foo<F>(f: F): F { return f } }
3 changes: 3 additions & 0 deletions crates/oxc_isolated_declarations/tests/snapshots/class.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ export declare class Foo {
export declare class Bar {
constructor(a?: number);
}
export declare class Zoo {
foo<F>(f: F): F;
}

0 comments on commit 2766594

Please sign in to comment.