-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Babel fails to transpile class Foo { [someSymbol]: Foo; }
#9189
Comments
Hey @jedwards1211! We really appreciate you taking the time to report an issue. The collaborators If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack |
…nericTypeAnnotation Fix babel#9189 Obviously this code is intended to throw an error if someone tries to reference a class before it's defined, like: ```js class Foo { someField = Foo; } ``` But there's no problem with referencing the class in a type annotation before it's defined, and this is often necessary for tree structures: ```js class Foo { [someSymbol]: Foo; } ```
…nericTypeAnnotation fix babel#9189 Obviously this code is intended to throw an error if someone tries to reference a class before it's defined, like: ```js class Foo { someField = Foo; } ``` But there's no problem with referencing the class in a type annotation before it's defined, and this is often necessary for tree structures: ```js class Foo { [someSymbol]: Foo; } ```
…nericTypeAnnotation fix babel#9189 Obviously this code is intended to throw an error if someone tries to reference a class before it's defined, like: ```js class Foo { someField = Foo; } ``` But there's no problem with referencing the class in a type annotation before it's defined, and this is often necessary for tree structures: ```js class Foo { [someSymbol]: Foo; } ```
…peAnnotation fix babel#9189 Obviously this code is intended to throw an error if someone tries to reference a class before it's defined, like: ```js class Foo { someField = Foo; } ``` But there's no problem with referencing the class in a type annotation before it's defined, and this is often necessary for tree structures: ```js class Foo { [someSymbol]: Foo; } ```
…peAnnotation (#9190) fix #9189 Obviously this code is intended to throw an error if someone tries to reference a class before it's defined, like: ```js class Foo { someField = Foo; } ``` But there's no problem with referencing the class in a type annotation before it's defined, and this is often necessary for tree structures: ```js class Foo { [someSymbol]: Foo; } ```
Bug Report
Notes
The following similar cases work:
class Foo { [someSymbol]: Bar }
class Foo { notASymbol: Foo }
The following cases fail:
class Foo { [someSymbol]: Foo }
class Foo { [someSymbol]: Array<Foo> }
class Foo { [someSymbol]: Foo.Bar }
Current Behavior
Input Code
Expected behavior/code
Transpiling succeeds
Babel Configuration (.babelrc, package.json, cli command)
Environment
The text was updated successfully, but these errors were encountered: