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

Isolated declaration leaves async keyword in methods #4120

Closed
sheremet-va opened this issue Jul 8, 2024 · 0 comments · Fixed by #4130
Closed

Isolated declaration leaves async keyword in methods #4120

sheremet-va opened this issue Jul 8, 2024 · 0 comments · Fixed by #4130
Assignees
Labels
A-isolated-declarations Isolated Declarations C-bug Category - Bug good first issue Experience Level - Good for newcomers

Comments

@sheremet-va
Copy link

sheremet-va commented Jul 8, 2024

async keyword is not allowed in isolated declarations.

Repro:

import { isolatedDeclaration } from 'oxc-transform'
import { transpileDeclaration } from 'typescript'

const code = `
class Test {
  async getValue(): Promise<string> {
    return 'Hello World';
  }
}
`

const oxc = isolatedDeclaration('test.ts', code)
const ts = transpileDeclaration(code, {})

console.log(
  oxc.sourceText,
  ts.outputText
)

Output:

declare class Test {
        async getValue(): Promise<string>;
}
 declare class Test {
    getValue(): Promise<string>;
}
@sheremet-va sheremet-va added the C-bug Category - Bug label Jul 8, 2024
@DonIsaac DonIsaac added good first issue Experience Level - Good for newcomers A-transformer Area - Transformer / Transpiler labels Jul 8, 2024
@Dunqing Dunqing added A-isolated-declarations Isolated Declarations and removed A-transformer Area - Transformer / Transpiler labels Jul 9, 2024
Boshen pushed a commit that referenced this issue Jul 9, 2024
@Dunqing Dunqing closed this as completed Jul 9, 2024
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-bug Category - Bug good first issue Experience Level - Good for newcomers
Projects
None yet
3 participants