-
-
Notifications
You must be signed in to change notification settings - Fork 722
Closed
Copy link
Labels
A-transformerArea - Transformer / TranspilerArea - Transformer / TranspilerP-highPriority - HighPriority - High
Description
export class Foo {
@methodDecorator
method(@paramDecorator param: string): boolean {
return !!param
}
}For the input above, the output of TypeScript (and SWC) runs the code related to paramDecorator before the code related to metadata. But the output of Oxc runs in the opposite order.
// TS output (omitted helpers)
export class Foo {
method(param) {
return !!param;
}
}
__decorate([
methodDecorator,
__param(0, paramDecorator),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", Boolean)
], Foo.prototype, "method", null);
// Oxc output
export class Foo {
method(param) {
return !!param;
}
}
_decorate([
methodDecorator,
_decorateMetadata("design:type", Function),
_decorateMetadata("design:paramtypes", [String]),
_decorateMetadata("design:returntype", Boolean),
_decorateParam(0, paramDecorator)
], Foo.prototype, "method", null);TS playground
SWC playground
reproduction using transform function exposed from rolldown
Metadata
Metadata
Assignees
Labels
A-transformerArea - Transformer / TranspilerArea - Transformer / TranspilerP-highPriority - HighPriority - High