oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.19k stars 2.77k forks source link

JSX empty type field for those functional components starting with uppercase letter #14797

Open 7flash opened 2 weeks ago

7flash commented 2 weeks ago

What version of Bun is running?

1.1.33

What platform is your computer?

macos

What steps can reproduce the bug?

function First() => <h1>second</h1>
const element = <First/>
console.log(JSON.stringify(element, null, 2)) // type field is missing

however, if you change to lowercase component name, then it all works as expected

const element = <first/>
console.log(element.type) // first

i understand, this might be expected behavior due to difference, where in second case is handled as a native tag. but then I'm still confused, how do I properly define my named components with children, without defining my own runtime/jsx ?

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

EliLichtblau commented 1 week ago

Behavior seems to match node.

Fixed syntax error in issue - if you run this in node it matches bun run test-case.tsx.

https://www.typescriptlang.org/play/?#code/MYewdgzgLgBAYgSwE7RgXhgCgJToHwwA8AFgIx4QCmoYAJoQPRl4BQNqlANpQLaViwMhRCigNW7ENwB0nEAHNMAKQDKAeQBy06EgRh5CAGYBPTF178oAGhhgArp042ATNlwMGMKMYAOlGIYIXLQwCBAwPGEQevIsbOAc3HwCzuhEgaLi8ZBSlLIKZkmWztLefu6eGdBAA