mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 22:56:11 +03:00
fix(es/typescript): Enable Injector to process JSX (#9395)
- Closes https://github.com/swc-project/swc/issues/9394
This commit is contained in:
parent
8e49c904d8
commit
e24e2ffe59
5
.changeset/wet-pets-check.md
Normal file
5
.changeset/wet-pets-check.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
swc_ecma_utils: patch
|
||||
---
|
||||
|
||||
fix(es/typescript): Enable Injector to process JSX
|
9
crates/swc/tests/fixture/issues-9xxx/9394/input/.swcrc
Normal file
9
crates/swc/tests/fixture/issues-9xxx/9394/input/.swcrc
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"jsc": {
|
||||
"parser": {
|
||||
"syntax": "typescript",
|
||||
"tsx": true
|
||||
},
|
||||
"target": "es2022"
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
class MyClass {
|
||||
constructor(private readonly myNumber: number) {
|
||||
const component = <MyComponent />;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
class MyClass {
|
||||
myNumber;
|
||||
constructor(myNumber){
|
||||
this.myNumber = myNumber;
|
||||
const component = /*#__PURE__*/ React.createElement(MyComponent, null);
|
||||
}
|
||||
}
|
@ -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};
|
||||
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user