Closed
Description
Bug Report
🔎 Search Terms
jsx empty
Possibly related issues:
Related SO question: Why does TypeScript ignore the type of JSX spread props if the JSX tag is not empty?
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about JSX.
⏯ Playground Link
Playground link with relevant code
💻 Code
This assumes JSX: React
const badProps = {
badProp: "foo",
};
// This doesn't compile; as expected.
function Test1() {
return <div {...badProps} />;
}
// This does compile; not expected.
function Test2() {
return <div {...badProps}> </div>;
}
🙁 Actual behavior
The expression in Test2
compiles without error.
🙂 Expected behavior
Type checks should apply to both empty and non-empty usages, and result in the same compilation error.