Closed
Description
TypeScript Version: 3.8.3
Either members with the same name of a type parameter are allowed, or they aren't. The current behavior does not make sense: They are allowed, but the member cannot be private if the class is exported.
Expected behavior:
No error is reported, since T
refers to the type parameter T
, not the member T
.
Actual behavior:
An error is reported:
Return type of public method from exported class has or is using private name 'T'.(4055)
Code
export class Test<T> {
private get T(): T {
throw "";
}
public test(): T {
return null as any;
}
}
Playground Link: Provided