Skip to content

[Bug]: export { type <ident> } doesn't mark <ident> as a type #15493

@lucacasonato

Description

@lucacasonato

💻

  • Would you like to work on a fix?

How are you using Babel?

Other (Next.js, Gatsby, vue-cli, ...)

Input code

import { A } from "./a.js";
export { type A };

Configuration file name

No response

Configuration

No response

Current and expected behavior

Current:

import { A } from "./a.js";
export {};

Expected:

export {};

Environment

Repl as of 2023-03-13

Possible solution

Mark <ident> as a type, just like you would with const a: <ident> = 1;.

Additional context

TS has the correct behaviour: https://www.typescriptlang.org/play?isolatedModules=true#code/PTAECMDoBcGcCgCWBbADgewE7VAb1AIKgC+oAZpusqAESTACGkAVrDQNzwCmAHhtnlDQAnqi6ES7IA

SWC has the same bug: swc-project/swc#7076

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions