Skip to content
This repository was archived by the owner on Jan 2, 2026. It is now read-only.

Commit 652fa72

Browse files
committed
fix: pass empty "" children value on self closing function element
1 parent 27a021a commit 652fa72

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ const type = "number";
146146
`\
147147
function LabeledInput(props) { return (\`<input type="\${type}"></input>\`); }
148148
const type = "number";
149-
LabeledInput({ type: type });
149+
LabeledInput({ type: type, children: "" });
150150
`
151151
);
152152
});

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ const transformer = <T extends ts.Node>(context: ts.TransformationContext) => (
118118
const parameters = node.attributes.properties.map(
119119
getObjectLiteralElementFromAttribute
120120
);
121+
parameters.push(
122+
ts.createPropertyAssignment("children", ts.createLiteral(""))
123+
);
121124
result.add(
122125
ts.createCall(node.tagName, [], [ts.createObjectLiteral(parameters)])
123126
);

0 commit comments

Comments
 (0)