Skip to content

[Bug]: TypeScript syntax error with overloaded private methods #13875

Closed
@ROpdebee

Description

💻

  • Would you like to work on a fix?

How are you using Babel?

@babel/cli

Input code

REPL with syntax error
REPL without syntax error

Configuration file name

babel.config.cjs

Configuration

module.exports = {
    presets: ['@babel/preset-typescript']
};

Current and expected behavior

When overloading private methods which use the ESNext # prefix, babel throws a syntax error and expects the opening brace for the overloaded methods. tsc parses and transpiles it correctly.

Since babel transpiles normal method overloads and non-overloaded private methods properly (see second REPL), I'd expect it to handle private method overloads too.

Environment

❯ npx envinfo --preset babel

  System:
    OS: macOS 11.5.2
  Binaries:
    Node: 16.12.0 - /usr/local/bin/node
    npm: 8.1.0 - /usr/local/bin/npm
  npmPackages:
    @babel/cli: ^7.15.7 => 7.15.7
    @babel/preset-typescript: ^7.15.0 => 7.15.0

❯ npx tsc --version
Version 4.4.4

Possible solution

No response

Additional context

No response

Metadata

Assignees

No one assigned

    Labels

    area: typescripti: needs triageoutdatedA 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