Skip to content
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

fix(es/codegen): Ensure decorators are emitted first in TS paramters #9545

Merged
merged 4 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions crates/swc_ecma_codegen/src/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,11 +688,9 @@ where
fn emit_ts_param_prop(&mut self, n: &TsParamProp) -> Result {
self.emit_leading_comments_of_span(n.span(), false)?;

self.emit_accessibility(n.accessibility)?;
self.emit_list(n.span, Some(&n.decorators), ListFormat::Decorators)?;

for dec in &n.decorators {
emit!(dec);
}
self.emit_accessibility(n.accessibility)?;

if n.is_override {
keyword!("override");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export class A {
constructor(
@IInstantiationService protected readonly _instantiationService: IInstantiationService,
@IContainerService private readonly _containerService: IContainerService,
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export class A {
constructor(
@IInstantiationService
protected readonly _instantiationService: IInstantiationService,
@IContainerService
private readonly _containerService: IContainerService){}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { field__2 } from "../validation/decorators";
class C__2 {
constructor(@field__2("a")
readonly field__3: string, @field__2("b")
constructor(
@field__2("a")
readonly field__3: string,
@field__2("b")
readonly b__3: string){}
}
Loading