fix(codegen): print type parameters for MethodDefinition (#3922)

close: #3918
This commit is contained in:
Dunqing 2024-06-26 07:21:41 +00:00
parent 27f0531aac
commit 27665945f1
3 changed files with 9 additions and 1 deletions

View file

@ -2410,6 +2410,9 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for MethodDefinition<'a> {
if self.computed { if self.computed {
p.print(b']'); p.print(b']');
} }
if let Some(type_parameters) = self.value.type_parameters.as_ref() {
type_parameters.gen(p, ctx);
}
p.print(b'('); p.print(b'(');
self.value.params.gen(p, ctx); self.value.params.gen(p, ctx);
p.print(b')'); p.print(b')');

View file

@ -5,3 +5,5 @@ export class Foo {
export class Bar { export class Bar {
public constructor(a: number = 0) {} public constructor(a: number = 0) {}
} }
export class Zoo { foo<F>(f: F): F { return f } }

View file

@ -10,3 +10,6 @@ export declare class Foo {
export declare class Bar { export declare class Bar {
constructor(a?: number); constructor(a?: number);
} }
export declare class Zoo {
foo<F>(f: F): F;
}