Skip to content

Syntax error when defining a class member field in javascript #8223

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
arinmirza opened this issue Jan 24, 2023 · 1 comment
Closed

Syntax error when defining a class member field in javascript #8223

arinmirza opened this issue Jan 24, 2023 · 1 comment

Comments

@arinmirza
Copy link

arinmirza commented Jan 24, 2023

Describe the bug

I am trying to define a simple class with a member field in between the <style> tags of a svelte component.

Functions and the constructor work as expected, but when I define a member field, I get a syntax error.

Reproduction

class A {

  baz = 'baz';

  constructor() {
    this.foo = `foo`;
  }

}

This syntax error in this example can be reproduced in this Svelte REPL snippet.

Logs

No response

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (12) x64 Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz
    Memory: 49.24 GB / 62.56 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    Yarn: 1.22.19 - ~/.asdf/shims/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
  Browsers:
    Chrome: 107.0.5304.110
    Firefox: 109.0

Severity

annoyance

@jasonlyu123
Copy link
Member

Duplicate of #6592

@jasonlyu123 jasonlyu123 marked this as a duplicate of #6592 Jan 24, 2023
@jasonlyu123 jasonlyu123 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants