I am trying to use the JSX syntax to allow users to create behavior trees with a nice hierarchical syntax:
const EnsureTargetNearby = (
<Fallback comment="Ensure mob nearby">
<IsMonsterNearby mobTypes={mobTarget} />
<MoveTo destinationOrKey={mobTarget} />
</Fallback>
);
const EnsureAlive = (
<Fallback comment="Ensure char alive">
<IsAlive />
<ThrottleDecorator delay={1000}>
<Respawn />
</ThrottleDecorator>
</Fallback>
);
However, I'm getting type issues related to the children prop. This error occurs on each node that expects one or more children:
Property 'children' is missing in type '{ comment: string; }' but required in type 'FallbackProps'.
I have prepared a minimal example showcasing the error: Link to playground
With my current configuration it seems like the JSX namespace is entirely ignored. If I changed to stupid types like null or string, nothing changes in the type errors.
Despite the type errors, this code executes perfectly well once forcibly transpiled. It's purely the type that is not working.
I initially followed the tutorial on https://dev.to/afl_ext/how-to-render-jsx-to-whatever-you-want-with-a-custom-jsx-renderer-cjk but I never managed to make jsxImportSource work.
I tried reading https://www.typescriptlang.org/docs/handbook/jsx.html but the docs are a bit too high level and don't go into much details regarding the specifics. Especially regarding the JSX namespace which I don't understand how to make properly available.
Of course I tried looking for people with similar problems but nothing helped: