Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
77 additions
and
60 deletions.
There are no files selected for viewing
25 changes: 19 additions & 6 deletions
25
crates/swc/tests/tsc-references/tsxSpreadChildren.1.normal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
//// [tsxSpreadChildren.tsx] | ||
//! | ||
//! x Spread children are not supported in React. | ||
//! ,---- | ||
//! 22 | {...todos.map(todo => <Todo key={todo.id} todo={todo.todo}/>)} | ||
//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
//! `---- | ||
import _extends from "@swc/helpers/src/_extends.mjs"; | ||
import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; | ||
function Todo(prop) { | ||
return /*#__PURE__*/ React.createElement("div", null, prop.key.toString() + prop.todo); | ||
} | ||
function TodoList(param) { | ||
var todos = param.todos; | ||
return /*#__PURE__*/ React.createElement.apply(React, [ | ||
"div", | ||
null | ||
].concat(_to_consumable_array(todos.map(function(todo) { | ||
return /*#__PURE__*/ React.createElement(Todo, { | ||
key: todo.id, | ||
todo: todo.todo | ||
}); | ||
})))); | ||
} | ||
var x; | ||
/*#__PURE__*/ React.createElement(TodoList, _extends({}, x)); |
10 changes: 4 additions & 6 deletions
10
crates/swc/tests/tsc-references/tsxSpreadChildren.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
//// [tsxSpreadChildren.tsx] | ||
//! | ||
//! x Spread children are not supported in React. | ||
//! ,---- | ||
//! 22 | {...todos.map(todo => <Todo key={todo.id} todo={todo.todo}/>)} | ||
//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
//! `---- | ||
var x; | ||
import _extends from "@swc/helpers/src/_extends.mjs"; | ||
import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; | ||
_extends({}, x); |
31 changes: 19 additions & 12 deletions
31
crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType(target=es2015).1.normal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
//// [tsxSpreadChildrenInvalidType.tsx] | ||
//! | ||
//! x Spread children are not supported in React. | ||
//! ,---- | ||
//! 21 | {...<Todo key={todos[0].id} todo={todos[0].todo} />} | ||
//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
//! `---- | ||
//! | ||
//! x Spread children are not supported in React. | ||
//! ,---- | ||
//! 27 | {...(<Todo key={todos[0].id} todo={todos[0].todo} /> as any)} | ||
//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
//! `---- | ||
import _extends from "@swc/helpers/src/_extends.mjs"; | ||
function Todo(prop) { | ||
return /*#__PURE__*/ React.createElement("div", null, prop.key.toString() + prop.todo); | ||
} | ||
function TodoList({ todos }) { | ||
return /*#__PURE__*/ React.createElement("div", null, .../*#__PURE__*/ React.createElement(Todo, { | ||
key: todos[0].id, | ||
todo: todos[0].todo | ||
})); | ||
} | ||
function TodoListNoError({ todos }) { | ||
// any is not checked | ||
return /*#__PURE__*/ React.createElement("div", null, .../*#__PURE__*/ React.createElement(Todo, { | ||
key: todos[0].id, | ||
todo: todos[0].todo | ||
})); | ||
} | ||
let x; | ||
/*#__PURE__*/ React.createElement(TodoList, _extends({}, x)); |
15 changes: 3 additions & 12 deletions
15
crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType(target=es2015).2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,4 @@ | ||
//// [tsxSpreadChildrenInvalidType.tsx] | ||
//! | ||
//! x Spread children are not supported in React. | ||
//! ,---- | ||
//! 21 | {...<Todo key={todos[0].id} todo={todos[0].todo} />} | ||
//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
//! `---- | ||
//! | ||
//! x Spread children are not supported in React. | ||
//! ,---- | ||
//! 27 | {...(<Todo key={todos[0].id} todo={todos[0].todo} /> as any)} | ||
//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
//! `---- | ||
let x; | ||
import _extends from "@swc/helpers/src/_extends.mjs"; | ||
_extends({}, x); |
40 changes: 28 additions & 12 deletions
40
crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType(target=es5).1.normal.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,29 @@ | ||
//// [tsxSpreadChildrenInvalidType.tsx] | ||
//! | ||
//! x Spread children are not supported in React. | ||
//! ,---- | ||
//! 21 | {...<Todo key={todos[0].id} todo={todos[0].todo} />} | ||
//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
//! `---- | ||
//! | ||
//! x Spread children are not supported in React. | ||
//! ,---- | ||
//! 27 | {...(<Todo key={todos[0].id} todo={todos[0].todo} /> as any)} | ||
//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
//! `---- | ||
import _extends from "@swc/helpers/src/_extends.mjs"; | ||
import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; | ||
function Todo(prop) { | ||
return /*#__PURE__*/ React.createElement("div", null, prop.key.toString() + prop.todo); | ||
} | ||
function TodoList(param) { | ||
var todos = param.todos; | ||
return /*#__PURE__*/ React.createElement.apply(React, [ | ||
"div", | ||
null | ||
].concat(_to_consumable_array(/*#__PURE__*/ React.createElement(Todo, { | ||
key: todos[0].id, | ||
todo: todos[0].todo | ||
})))); | ||
} | ||
function TodoListNoError(param) { | ||
var todos = param.todos; | ||
// any is not checked | ||
return /*#__PURE__*/ React.createElement.apply(React, [ | ||
"div", | ||
null | ||
].concat(_to_consumable_array(/*#__PURE__*/ React.createElement(Todo, { | ||
key: todos[0].id, | ||
todo: todos[0].todo | ||
})))); | ||
} | ||
var x; | ||
/*#__PURE__*/ React.createElement(TodoList, _extends({}, x)); |
16 changes: 4 additions & 12 deletions
16
crates/swc/tests/tsc-references/tsxSpreadChildrenInvalidType(target=es5).2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,5 @@ | ||
//// [tsxSpreadChildrenInvalidType.tsx] | ||
//! | ||
//! x Spread children are not supported in React. | ||
//! ,---- | ||
//! 21 | {...<Todo key={todos[0].id} todo={todos[0].todo} />} | ||
//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
//! `---- | ||
//! | ||
//! x Spread children are not supported in React. | ||
//! ,---- | ||
//! 27 | {...(<Todo key={todos[0].id} todo={todos[0].todo} /> as any)} | ||
//! : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
//! `---- | ||
var x; | ||
import _extends from "@swc/helpers/src/_extends.mjs"; | ||
import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; | ||
_extends({}, x); |