Skip to content

Commit

Permalink
Fix component child bug
Browse files Browse the repository at this point in the history
  • Loading branch information
deamme committed Feb 11, 2018
1 parent 8932f8f commit 82c4fe2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ export default () => {
) {
// Remove children from props, if it exists
for (i = 0; i < props.properties.length; i++) {
// console.log(props.properties[i])
if (
props.properties[i] &&
props.properties[i].name.text === "children"
Expand All @@ -128,6 +127,8 @@ export default () => {
props.properties.push(
ts.createPropertyAssignment(getName("children"), vChildren)
);

vProps.props[0] = props
}
vChildren = NULL;
}
Expand Down
1 change: 1 addition & 0 deletions tests/cases/Component1.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<Com>{a}</Com>;
5 changes: 5 additions & 0 deletions tests/cases/Component2.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Com>
{a}
{b}
{c}
</Com>;
5 changes: 5 additions & 0 deletions tests/cases/Component3.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Comp>
<p>child1</p>
<p>child2</p>
<p>child3</p>
</Comp>;

0 comments on commit 82c4fe2

Please sign in to comment.