You can write an inline type literal for the call signatures the function supports:
class TestOverloads2 {
private status = "blah";
public doStuff: {
(selector: JQuery): void;
(selector: string): void;
} = (selector: any) => {
alert(this.status);
}
}
That’s sort of hideous, so you might want to extract it into an interface instead:
interface SelectByJQueryOrString {
(selector: JQuery): void;
(selector: string): void;
}
class TestOverloads3 {
private status = "blah";
public doStuff: SelectByJQueryOrString = (selector: any) => {
alert(this.status);
}
}