Skip to content

transformer: parameter properties should be affected by useDefineForClassFields #21600

@sapphi-red

Description

@sapphi-red

When useDefineForClassFields is enabled,

class Foo {
  constructor(public b1 = 2.1) {
  }
}

is transformed to

class Foo {
	constructor(b1 = 2.1) {
		this.b1 = b1;
	}
}

playground.
But it should be transformed to

class Foo {
	b1;
	constructor(b1 = 2.1) {
		this.b1 = b1;
	}
}

(TS playground).

refs evanw/esbuild#4421

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-transformerArea - Transformer / Transpiler

    Type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions