Closed
Description
TypeScript Version: 2.7.0-dev.201xxxxx
Search Terms:
Code
can we use typeof on return type with T
// @ts-ignore
export function getStatic<T>(target: T): typeof T
{
// @ts-ignore
return target.__proto__.constructor;
}
but at real case i have write
// @ts-ignore
export function getStatic<T>(target): T
{
// @ts-ignore
return target.__proto__.constructor;
}
export class A
{
static b()
{
console.log('this is static b');
}
b()
{
console.log('this is b');
}
}
export let a = new A();
export const c = getStatic<typeof A>(a);
c.b();
a.b();
Expected behavior:
export declare function getStatic<T>(target: T): typeof T;
Actual behavior:
export declare function getStatic<T>(target: T): T;
Playground Link:
Related Issues: