Skip to content

isolatedDeclaration emits excess parentheses in union types #3916

@MichaelMitchell-at

Description

@MichaelMitchell-at

While not technically wrong, it might be unexpected? Not a dealbreaker, it just came up when I was running a comparison between ts.transpileDeclaration and this.

> require('oxc-transform').isolatedDeclaration("hello.ts", `export function foo(): number | undefined {}`)
{
  sourceText: 'export declare function foo(): ((number) | (undefined));\n',
  errors: []
}
> require('oxc-transform').isolatedDeclaration("hello.ts", `export const foo: number | undefined = 42`)
{
  sourceText: 'export declare const foo: ((number) | (undefined));\n',
  errors: []
}

Metadata

Metadata

Assignees

Labels

C-bugCategory - Bug

Type

No type

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions