Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Unexpected token syntax error is thrown with classStaticBlock and typescript. #13234

Closed
1 task done
sosukesuzuki opened this issue Apr 30, 2021 · 5 comments 路 Fixed by #13243
Closed
1 task done
Assignees
Labels
area: errors area: typescript i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser Spec: Class Static Block

Comments

@sosukesuzuki
Copy link
Member

馃捇

  • Would you like to work on a fix?

How are you using Babel?

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

Input code

class Foo {
  static {}
}

Configuration file name

No response

Configuration

Use classStaticBlock and typescript plugin.

const { parse } = require("@babel/parser");

const code =`class Foo {
  static {}
}`;

const result = parse(code, {
  sourceType: "module",
  errorRecovery: true,
  plugins: ["classStaticBlock", "typescript"],
});

Current and expected behavior

current:

SyntaxError: Unexpected token

expected:

no error

Environment

  • @babel/parser 7.14.0

Possible solution

No response

Additional context

prettier/prettier#10802 (comment)

@JounQin
Copy link
Contributor

JounQin commented Apr 30, 2021

+1 for this, I'm also facing this issue when upgrading babel in un-ts/babel-preset-proposal-typescript#115.

@ddolcimascolo
Copy link

ddolcimascolo commented Apr 30, 2021

Hey guys, we have tests that start to fail with an automated upgrade of babel to v 7.14.0.
Context is a CRA with nothing fancy but I can't confirm we're hit by this exact problem, I'll provide all the details later today and create a separate issue if it's not the same thing.

Cheers,
David

@nicolo-ribaudo
Copy link
Member

Was this working in previous versions? If yes, I guess the bug has been introduced by #13209

@JounQin
Copy link
Contributor

JounQin commented Apr 30, 2021

@nicolo-ribaudo Yes, it was working previously.

@ddolcimascolo
Copy link

Hey guys, we have tests that start to fail with an automated upgrade of babel to v 7.14.0.
Context is a CRA with nothing fancy but I can't confirm we're hit by this exact problem, I'll provide all the details later today and create a separate issue if it's not the same thing.

Cheers,
David

Guys, sorry for the noise our failure was totally unrelated 馃憖

Cheers,
David

@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Aug 3, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: errors area: typescript i: bug i: regression outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser Spec: Class Static Block
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants