8000 Base type is not declared or exported when emitting declarations · Issue #10620 · swc-project/swc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Base type is not declared or exported when emitting declarations #10620
Closed
@menny

Description

@menny

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

https://play.swc.rs/?version=1.12.1&code=H4sIAAAAAAAAA2WQTU7DMBCF9z7FqCtHQhwgIV3AioIQolzAcQdqyfVEHkdtVfnu2MEpGLwYyfPzzXujrWKGV%2FRMDi4CQJPj4CcdyMtxGqzR4NQBW0hZ4z5voCQtaRUMuaXQwCWKKEQ4j1h4Dz8o6MHhEWSN%2Bs%2Fo12W2E2JWUr786DbK2Bbkr56a%2F13JFjyGyTvQszU8BXS7yiKAKTzZtDAQWVRLJb8yH%2FaGb7Ng6PseVluzQ97TEe5pWHVzc0wxdiJexb7gAdnw89XX24x6Tze5y4ehj9rPOumuErJJLDyN5EPR%2F%2BQnDudtXrxY%2BbMlHf4LVBUNb8YBAAA%3D&config=H4sIAAAAAAAAA1WMOQ6AMAwEe14RueYF1DQUPCIKLoI4LNtIQYi%2FY64Iut0Z7W6Fc9BLgMptFq2QZ0HO3Yisk%2FpkBHQllMCRFMrXqpxKecGL7LcATIQcR7Tp8Dk7zRi1kXnwil2t8hsXzwHIvHDA1lP2%2BwE5e0RDqwAAAA%3D%3D

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 {};

from tsc: https://www.typescriptlang.org/play/?#code/MYGwhgzhAEAKCmAnCB7AdtA3gKGtY6EALogK7BEqIAUADqQEYgCWw0aYAtvAFzTGJmaAOYAaaPSatoIFMDBFm6PgKHCAlFgC+2HdiIBPWvDhJUaAMKES5SomgBedvADu0ah24qSa8bPmKyvw+IpoOAHymyOgA3NjYBGjEUeYQAJJoAFJgzCB81GGRCNGW1mQUVI7uhVi40IjwRKSIGKCQMPAAHkTwaAAmMMXmtXh4zOlZOSAFfAwoKCDwYBg4o2v1jc0YRAAW4wB0niYOJ9AARADKzH3wEDsobgBCKAxncWs6eFpx3-GJyQA5eDcCDjAAycgUSjQfAASpsWgAVIzwAA8hmMKAAZilCBlsrlIk4hnjJrkCnFsF1aFQiPhwFBoABpMjEAwXe5uLo9fowIEg8GQwIrLRAA

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0