Closed
Description
Bug Report
🔎 Search Terms
When class declared and returned in the function, .d.ts declaration does not meet the expectations
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about declaration and class method
⏯ Playground Link
Playground link with relevant code
💻 Code
// const Foo = (function() {
// return class Foo {
// name: string = 'shulandmimi';
// extend(): Foo {
// return new Foo();
// }
// }
// })();
// or
const Foo = class Foo {
name: string = 'shulandmimi';
extend(): Foo {
return new Foo();
}
};
const foo_instance = new Foo();
// in playground: (method) Foo.extend(): Foo; foo1: Foo;
// in .d.ts: (method) Foo.extend(): any; foo1: any
const foo1 = foo_instance.extend();
🙁 Actual behavior
declare const Foo: {
new (): {
name: string;
extend(): any;
};
};
declare const foo_instance: {
name: string;
extend(): any;
};
declare const foo1: {
name: string;
extend(): any;
};
🙂 Expected behavior
declare const Foo: {
new (): {
name: string;
extend(): Foo;
};
};
declare const foo_instance: {
name: string;
extend(): Foo;
};
declare const foo1: {
name: string;
extend(): Foo;
};