diff --git a/crates/swc/tests/fixture/issues-4xxx/issue-4296/1/input/.swcrc b/crates/swc/tests/fixture/issues-4xxx/issue-4296/1/input/.swcrc new file mode 100644 index 00000000000..c69c5a2267e --- /dev/null +++ b/crates/swc/tests/fixture/issues-4xxx/issue-4296/1/input/.swcrc @@ -0,0 +1,14 @@ +{ + "jsc": { + "transform": { + "hidden": { + "jest": true + } + }, + "target": "es2022", + "parser": { + "syntax": "typescript", + "tsx": true + } + } +} \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-4xxx/issue-4296/1/input/index.tsx b/crates/swc/tests/fixture/issues-4xxx/issue-4296/1/input/index.tsx new file mode 100644 index 00000000000..c98cb113271 --- /dev/null +++ b/crates/swc/tests/fixture/issues-4xxx/issue-4296/1/input/index.tsx @@ -0,0 +1,29 @@ +import React from "react"; + +interface ListProps { + callback: () => void; +} + +const SomeList = ({ callback }: ListProps) => { + callback(); + + return
; +}; + +const list = [0]; + +const MyComponent = (): JSX.Element => { + return ( +
+ {list.map(() => + true ? ( + console.log("do something")} + /> + ) : ( +
+ ) + )} +
+ ); +}; diff --git a/crates/swc/tests/fixture/issues-4xxx/issue-4296/1/output/index.tsx b/crates/swc/tests/fixture/issues-4xxx/issue-4296/1/output/index.tsx new file mode 100644 index 00000000000..461c35242b0 --- /dev/null +++ b/crates/swc/tests/fixture/issues-4xxx/issue-4296/1/output/index.tsx @@ -0,0 +1,14 @@ +import React from "react"; +const SomeList = ({ callback })=>{ + callback(); + return /*#__PURE__*/ React.createElement("div", null); +}; +const list = [ + 0 +]; +const MyComponent = ()=>{ + return /*#__PURE__*/ React.createElement("div", null, list.map(()=>true ? /*#__PURE__*/ React.createElement(SomeList, { + callback: ()=>console.log("do something") + }) : /*#__PURE__*/ React.createElement("div", null) + )); +};