Skip to content

[Bug]: onlyRemoveTypeImports: true should not remove imports with only inline type specifier #15348

@latin-1

Description

@latin-1

💻

  • Would you like to work on a fix?

How are you using Babel?

@babel/cli

Input code

import { type T } from "./mod";

Configuration file name

babel.config.json

Configuration

{
  "presets": [
    ["@babel/preset-typescript", { "onlyRemoveTypeImports": true }]
  ]
}

Current and expected behavior

Current behavior:

// empty

Expected behavior / tsc with "isolatedModules": true and "importsNotUsedAsValues": "error":

import "./mod";

Environment

  System:
    OS: Linux 6.1 Arch Linux
  Binaries:
    Node: 19.3.0 - /usr/bin/node
    Yarn: 4.0.0-rc.35 - ~/.local/bin/yarn
    npm: 8.19.2 - /usr/bin/npm
  npmPackages:
    @babel/cli: ^7.20.7 => 7.20.7 
    @babel/core: ^7.20.12 => 7.20.12 
    @babel/preset-typescript: ^7.18.6 => 7.18.6 

Possible solution

No response

Additional context

microsoft/TypeScript#47118 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: typescriptoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions