8000 [isolatedDeclarations] transform fails if a parameter on a private constructor has no annotation · Issue #10674 · swc-project/swc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
8000
Skip to content
[isolatedDeclarations] transform 8000 fails if a parameter on a private constructor has no annotation #10674
Closed
@magic-akari

Description

@magic-akari

Describe the bug

Input code

export class Foo {
  private constructor(foo = new Set<string>()) {}
}

Config

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": false
    },
    "target": "es2024",
    "experimental": {
      "emitIsolatedDts": true
    },
  }
}

Link to the code that reproduces this issue

https://play.swc.rs/?version=1.12.5&code=H4sIAAAAAAAAA0utKMgvKlFIzkksLlZwy89XqOZSUCgoyixLLElVSM7PKy4pKk0uyS%2FSSAPK2SrkpZYrBKeW2ACFM%2FPS7TQ0NRWqa7lquQChUB5wRwAAAA%3D%3D&config=H4sIAAAAAAAAA02NvQrCQBCE%2BzzFsbWFBCvrND7GEUc5ueixO0JCuHfPxp%2BQbuf7mNm5CUEe1ss5zH56KFENumUnNj0ZRyfCqcB6TYVy%2BFvaqm4xGz6ofo0w6h1cW7D22J5%2BDcFYoGmAb%2Bb9FwyJF3vlSFw7mivqezdZm7oAZVbTpq0AAAA%3D

SWC Info output

No response

Expected behavior

Transforms fine with no errors as per the TS playground which shows no errors and should emit the following dts:

export declare class Foo {
    private constructor();
}

Actual behavior

  x TS9011: Parameter must have an explicit type annotation with --isolatedDeclarations.
   ,-[input.ts:2:1]
 1 | export class Foo {
 2 |   private constructor(foo = new Set<string>()) {}
   :                       ^^^^^^^^^^^^^^^^^^^^^^^
 3 | }
   `----

Version

1.12.5

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0