Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect 'TS9021: Extends clause can't contain an expression with --isolatedDeclarations.' when using emitIsolatedDts #9817

Closed
ericrafalovsky opened this issue Dec 28, 2024 · 1 comment · Fixed by #9822
Assignees
Labels

Comments

@ericrafalovsky
Copy link

Describe the bug

swc appears to throw an incorrect "TS9021: Extends clause can't contain an expression with --isolatedDeclarations." error for the below code when using the experimental emitIsolatedDts feature.

Input code

import React from "react";

export class Component extends React.PureComponent<{}, {}> {

    render(): React.ReactNode {
        return <div>Hello world</div>;
    }
}

Config

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": true
    },
    "experimental": {
        "emitIsolatedDts": true
    }
  },
  "sourceMaps": true
}

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.10.3&code=H4sIAAAAAAAAA0XLQQrCMBAF0H1O8elKQXRvQzZuXEkRL1CaEQppRiapFkLubhoL%2FsUwzH8zTi%2BWiDv1Q8RTeEIj6960StFSu8H1IeDCRXryUT8MaInkbfi9HbtZ6F%2BnfEDKBkkplEiBJLv9ecN13thSAdgiFGfx0HZ8mys5x%2FiwOKtP66GtLKv8BZn347CrAAAA&config=H4sIAAAAAAAAA1WMOQ6AMAwEe14RueYF1DQUPCIKLoI4LNtIQYi%2FY64Iut0Z7W6Fc9BLgMptFq2QZ0HO3Yisk%2FpkBHQllMCRFMrXqpxKecGL7LcATIQcR7Tp8Dk7zRi1kXnwil2t8hsXzwHIvHDA1lP2%2BwE5e0RDqwAAAA%3D%3D

SWC Info output

No response

Expected behavior

See TypeScript playground link where this code successfully compiles under --isolatedDeclarations

https://www.typescriptlang.org/play/?isolatedDeclarations=true#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgIilQ3wG4AocpAD0ljjQBsUBnFuAYV0gDskeYAHgAqAPjg0Y-ACbtk6GADoACgFciXcBD4DBAbwC+AGjiHxeynCtwiPaUigAKAJQAuRMSXyMAOQj3TcmtgmyQYdR44QWlgADdRAAkkRkYIOAB3aEZpQQB6GPiKYINyAyA

Actual behavior

No response

Version

1.10.3

Additional context

No response

@swc-bot
Copy link
Collaborator

swc-bot commented Jan 30, 2025

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Jan 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants