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

isolatedDeclarations does not support well-known symbols as properties #4016

Open
MichaelMitchell-at opened this issue Jul 2, 2024 · 4 comments
Labels
A-isolated-declarations Isolated Declarations C-enhancement Category - New feature or request E-Help Wanted Experience level - For the experienced collaborators

Comments

@MichaelMitchell-at
Copy link
Contributor

Tested version: 0.16.3

> require('oxc-transform').isolatedDeclaration('hello.ts', `
    export class Foo {
      [Symbol.hasInstance](): boolean {
        return false;
      }
    }
`)
{
  sourceText: 'export declare class Foo {}\n',
  errors: [
    'TS9038: Computed property names on class or object literals cannot be inferred with --isolatedDeclarations.'
  ]
}

Expected:

export declare class Foo {
    [Symbol.hasInstance](): boolean;
}

Actual:

export declare class Foo {}

TS behavior for reference

@MichaelMitchell-at MichaelMitchell-at added the C-bug Category - Bug label Jul 2, 2024
@Dunqing Dunqing added the A-isolated-declarations Isolated Declarations label Jul 2, 2024
@MichaelMitchell-at
Copy link
Contributor Author

This was fixed in a more recent version of TypeScript, specifically in this PR: microsoft/TypeScript#58771

If you switch the version used in the playground to nightly, the error no longer exists.

@Dunqing
Copy link
Member

Dunqing commented Jul 2, 2024

This was fixed in a more recent version of TypeScript, specifically in this PR: microsoft/TypeScript#58771

If you switch the version used in the playground to nightly, the error no longer exists.

Thank you for your mentioning this. We will support this soon

@Dunqing Dunqing added C-enhancement Category - New feature or request and removed C-bug Category - Bug labels Jul 2, 2024
@Dunqing Dunqing self-assigned this Jul 2, 2024
@Dunqing Dunqing added the E-Help Wanted Experience level - For the experienced collaborators label Jul 2, 2024
@Dunqing
Copy link
Member

Dunqing commented Jul 2, 2024

It may be released in TypeScript 5.6, So it's not a high priority at the moment for us. If anyone is interested, feel free to send a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-isolated-declarations Isolated Declarations C-enhancement Category - New feature or request E-Help Wanted Experience level - For the experienced collaborators
Projects
None yet
2 participants