Skip to content

transfomer: When the target is earlier than 2022, class declare fields are not transformed correctly #13733

@shulaoda

Description

@shulaoda

Description

With target: 2021, class declare fields are not transformed correctly. Playground link

class A {
  constructor(public domNode: Node) {
    console.log('A');
  }
}

class B extends A {
  constructor(domNode: Node) {
    super(domNode);
    console.log('B');
  }
}

class C extends B {
  declare domNode: HTMLElement;
  log() {
    console.log('C', this.domNode)
  }
}

new C(6).log()

Expected

C 6

Actual

C undefined

Original Issue

Ref: rolldown/rolldown#6020

Metadata

Metadata

Assignees

Labels

A-transformerArea - Transformer / Transpiler

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions