Closed
Description
Describe the bug
When exporting a class that extends another symbol which is a ReturnType
, the symbol in the ReturnType
is not declated
Input code
class Person {
constructor(public name: string, public location: string) {}
}
type PersonConstructor = new (name: string, location: string) => Person;
const PersonsInJail: () => PersonConstructor = () => {
return class extends Person {
isInJail(): boolean {
return this.name === "Sideshow Bob";
}
};
};
const NemesisLocation: ReturnType<typeof PersonsInJail> = PersonsInJail();
export class KrustyShow extends NemesisLocation {}
Config
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true
},
"experimental": {
"emitIsolatedDts": true
}
},
"sourceMaps": true
}
Link to the code that reproduces this issue
SWC Info output
v1.12.1
Expected behavior
declare class Person {
name: string;
location: string;
constructor(name: string, location: string);
}
type PersonConstructor = new (name: string, location: string) => Person;
declare const PersonsInJail: () => PersonConstructor;
declare const NemesisLocation: ReturnType<typeof PersonsInJail>;
export declare class KrustyShow extends NemesisLocation {
}
export {};
Actual behavior
output from swc:
declare const NemesisLocation: ReturnType<typeof PersonsInJail>;
export declare class KrustyShow extends NemesisLocation {
}
export { };
Version
1.12.1
Additional context
No response