Skip to content

[Bug]: does not support latest TS import type syntax #14521

@chriskrycho

Description

@chriskrycho

💻

  • Would you like to work on a fix?

How are you using Babel?

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

Input code

import { type default as Potato } from 'somewhere';

repl repro

Configuration file name

No response

Configuration

N/A: this shows up even in the REPL.

Current and expected behavior

Current behavior: Babel errors on this, with the following output:

> 1 | import { type default as Potato } from 'somewhere';
    |               ^

Expected behavior: this should parse! See this TS playground for an example.

Note that this is specific to the type default as Binding form: using import { type namedExport } from 'somewhere' parses fine, even if and as you stack multiple of those, including along with named value imports.

Environment

Babel version: 7.17.11 (reproducible anywhere)

Possible solution

Looks like this "just" needs to update the parser to understand that this is valid syntax as of TypeScript 4.5.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedA 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