Skip to content

transformer: design:type emits void 0 for getter/setter decorators #20368

@sapphi-red

Description

@sapphi-red
function Dec(): PropertyDecorator { return () => {}; }
 
class Example {
    @Dec()
    get myProp() { return 'hello'; }
}

For this input, Oxc outputs

function Dec() {
	return () => {};
}
class Example {
	get myProp() {
		return "hello";
	}
}
_decorate([
	Dec(),
	_decorateMetadata("design:type", void 0),
	_decorateMetadata("design:paramtypes", [])
], Example.prototype, "myProp", null);

(playground)
but it should be

function Dec() {
	return () => {};
}
class Example {
	get myProp() {
		return "hello";
	}
}
_decorate([
    Dec(),
    _decorateMetadata("design:type", Object), // <-- this line is the diff
    _decorateMetadata("design:paramtypes", [])
], Example.prototype, "myProp", null);

(TS playground).

Metadata

Metadata

Assignees

Labels

A-transformerArea - Transformer / TranspilerP-highPriority - High

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions