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/typescript): Enable Injector to process JSX #9395

Merged
merged 3 commits into from
Aug 7, 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
5 changes: 5 additions & 0 deletions .changeset/wet-pets-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
swc_ecma_utils: patch
---

fix(es/typescript): Enable Injector to process JSX
9 changes: 9 additions & 0 deletions crates/swc/tests/fixture/issues-9xxx/9394/input/.swcrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": true
},
"target": "es2022"
}
}
5 changes: 5 additions & 0 deletions crates/swc/tests/fixture/issues-9xxx/9394/input/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class MyClass {
constructor(private readonly myNumber: number) {
const component = <MyComponent />;
}
}
7 changes: 7 additions & 0 deletions crates/swc/tests/fixture/issues-9xxx/9394/output/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class MyClass {
myNumber;
constructor(myNumber){
this.myNumber = myNumber;
const component = /*#__PURE__*/ React.createElement(MyComponent, null);
}
}
6 changes: 2 additions & 4 deletions crates/swc_ecma_utils/src/constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use std::iter;

use swc_common::{util::take::Take, DUMMY_SP};
use swc_ecma_ast::*;
use swc_ecma_visit::{
noop_visit_mut_type, standard_only_fold, Fold, FoldWith, VisitMut, VisitMutWith,
};
use swc_ecma_visit::{noop_fold_type, noop_visit_mut_type, Fold, FoldWith, VisitMut, VisitMutWith};

use crate::{prepend_stmts, ExprFactory};

Expand Down Expand Up @@ -36,7 +34,7 @@ struct Injector<'a> {
}

impl<'a> Fold for Injector<'a> {
standard_only_fold!();
noop_fold_type!();

fn fold_class(&mut self, c: Class) -> Class {
c
Expand Down
Loading