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

Curly braces added to namespace export (export *) #1390

Closed
egasimus opened this issue Mar 3, 2024 · 1 comment · Fixed by #1391
Closed

Curly braces added to namespace export (export *) #1390

egasimus opened this issue Mar 3, 2024 · 1 comment · Fixed by #1391

Comments

@egasimus
Copy link

egasimus commented Mar 3, 2024

export [type] * as Foobar from "./foo" parses to the following (simplified). Trying to print it back into code adds an extra pair of curly braces.

import recast from 'recast'
for (const exportKind of ["value", "type"]) {
  console.log(recast.print({
    type: 'ExportNamedDeclaration',
    exportKind,
    specifiers: [
      {
        type: 'ExportNamespaceSpecifier',
        exported: {
          type: 'Identifier',
          name: 'Foobar'
        }
      }
    ],
    source: {
      type: 'StringLiteral',
      value: './foo',
    }
  }).code)
}

Expected:

export * as Foobar from "./foo";
export type * as Foobar from "./foo";

Actual:

export { * as Foobar } from "./foo";
export type { * as Foobar } from "./foo";

Context:

I'm trying to modify some .d.mts files, and TS balks at the extra curly braces.

@eventualbuddha
Copy link
Collaborator

Fixed in v0.23.6.

coderaiser pushed a commit to coderaiser/recast that referenced this issue May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants