-
Notifications
You must be signed in to change notification settings - Fork 618
support for useDefineForClassFields
#785
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
Comments
for reasons that are not clear to me, in the vscode codebase the generated syntax is es2020 style even though the tsconfig says es2022
|
is the printer the right place for this? diff --git i/internal/printer/printer.go w/internal/printer/printer.go
index 7b65f042a..1dee8bc9c 100644
--- i/internal/printer/printer.go
+++ w/internal/printer/printer.go
@@ -2843,6 +2843,7 @@ func (p *Printer) emitSpreadElement(node *ast.SpreadElement) {
}
func (p *Printer) emitClassExpression(node *ast.ClassExpression) {
+ target := p.currentSourceFile.LanguageVersion
state := p.enterNode(node.AsNode())
p.generateNameIfNeeded(node.Name())
@@ -2863,7 +2864,13 @@ func (p *Printer) emitClassExpression(node *ast.ClassExpression) {
p.writePunctuation("{")
p.pushNameGenerationScope(node.AsNode())
p.generateAllMemberNames(node.Members)
- p.emitList((*Printer).emitClassElement, node.AsNode(), node.Members, LFClassMembers)
+ if target >= core.ScriptTargetES2022 {
+ p.emitList((*Printer).emitClassElement, node.AsNode(), node.Members, LFClassMembers)
+ } else {
+ // !!!
+ // add constructor declaration if missing
+ // move property decls into constructor body?
+ }
p.popNameGenerationScope(node.AsNode())
p.writePunctuation("}")
EDIT: would need to handle |
okay i see there is a transformation layer, so maybe this belongs in |
I think I misdiagnosed my issue and I don't actually need es2020 compat classes. Something else is causing generated JS not to load. |
|
None of the downleveling is supported yet. |
makes sense. the other issue i ran into was decorators being emitted. |
Right, that'd be the esnext transform which removes it. |
not clear what the equivalent of this is on the golang side. maybe |
|
#819 added an typescript-go/internal/transformers/transformer.go Lines 92 to 93 in 3978f50
|
hoping for some pointers on how to start about fixing this:
The text was updated successfully, but these errors were encountered: