Replies: 3 comments
-
It might be good to look how Solid exports this ourselves (they show up at build time on the repo). I have found this requires a little bit of play in the past. But Solid's repo export 2 different jsx runtimes. Might serve as an example. I don't actually have a custom renderer example with TSX offhand. Generally you need a jsx.d.ts that defines all the elements you need. From there it should be a matter of setting the jsxImportSource. I'm going to move this to discussions and see if anyone else has experience here. |
Beta Was this translation helpful? Give feedback.
-
Ok, here are my notes from building my own typescript custom renderer: From react you may be used to just typing https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L3307 In the future, I guess, it's expected that you import JSX explicitly via The typescript compiler internally, to understand your jsx, now automatically imports https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/jsx-runtime.d.ts Importantly, that means that means you must have a Beyond that, you probably want to export the JSX namespace to users of your renderer too, so they can write types with JSX expressions in them. The name here doesn't matter, In terms of the contents of the JSX namespace, the typescript official docs cover what each type does and what typescript can check for you: https://www.typescriptlang.org/docs/handbook/jsx.html hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hi,
I am trying to implement a custom renderer for solid but I am getting intellisense errors in visual studio code regarding the typing of JSX.Element.
At the bottom of https://github.com/solidjs/solid/tree/main/packages/solid/universal#readme there is this:
But i can't seem to figure out how to get it to work; can you please provide more clarification on what is involved? How do i add a "jsx-runtime entry" ?
I tried simply declaring JSX.ELement in a file and passing the reference to jsxImportSource but it has no effect.
Beta Was this translation helpful? Give feedback.
All reactions