Skip to content

[Bug]: Fails to parse type declarations like type satisfies = 0; #16048

@seiyab

Description

@seiyab

💻

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

type satisfies = 0;

Configuration file name

No response

Configuration

No response

Current and expected behavior

Current babel parser fails to parse it with following error:

/repl.ts: Unexpected token (1:15)

> 1 | type satisfies = 0;
    |                ^

It should be successfully parsed as TypeScript Playground doesn't report any errors.
https://www.typescriptlang.org/play?#code/C4TwDgpgBAzghsAljAZoiMoF4oAYDcQA

Environment

System:
  OS: macOS 13.4.1
Binaries:
  Node: 17.7.2 - ~/.asdf/installs/nodejs/17.7.2/bin/node
  Yarn: 3.6.3 - ~/.asdf/installs/nodejs/17.7.2/.npm/bin/yarn
  npm: 8.5.2 - ~/.asdf/plugins/nodejs/shims/npm
npmPackages:
  @babel/code-frame: 7.22.13 => 7.22.13
  @babel/generator: 7.22.15 => 7.22.15
  @babel/parser: 7.23.0 => 7.23.0
  @babel/types: 7.23.0 => 7.23.0
  eslint: 8.50.0 => 8.50.0
  jest: 29.7.0 => 29.7.0

Instantly reproducible here: https://babeljs.io/repl#?browsers=defaults%2C%20not%20ie%2011%2C%20not%20ie_mob%2011&build=&builtIns=false&corejs=3.21&spec=false&loose=false&code_lz=C4TwDgpgBAzghsAljAZoiMoF4oAYDcQA&debug=false&forceAllTransforms=false&modules=false&shippedProposals=false&circleciRepo=&evaluate=false&fileSize=false&timeTravel=false&sourceType=module&lineWrap=true&presets=env%2Cstage-2%2Ctypescript&prettier=false&targets=&version=7.23.2&externalPlugins=&assumptions=%7B%7D

Possible solution

No response

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 issuepkg: parser

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions