microsoft / microsoft/TypeScript-Website
The JSX namespace docs lack concrete examples
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.6k
- Forks
- 1.5k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 7
Description
Page URL: https://www.typescriptlang.org/docs/handbook/jsx.html#the-jsx-namespace
I've spent way too many hours trying to understand how to create my own JSX factory and let TS recognize it properly.
In the past I've asked a StackOverflow question which finally made the thing work.
Today, I've tried changing my implementation so I can use a non-global namespace like the docs suggest preact does with h and h.JSX.
However, I never managed to make that work, I tried all kinds of things. This led me to believe that the docs themselves are extremely lacking and, in particular, lack very concrete examples of how to make it work entirely.
And, to emphasize, I really am talking about the namespace definition itself, NOT its content which is quite easy to understand by reading the following sections on the page.
Though the sections are clear, they still use code that don't work as-is. For example, this playground and this one do not work as described by the comments because the namespace is probably wrongly defined.
(If, for any reason, you want to see where I'm at: my tsconfig.json and my factory/types.)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the JSX namespace section at typescriptlang.org/docs/handbook/jsx.html#the-jsx-namespace and reproduce the behavior in the linked TypeScript playgrounds. Compare the documented namespace patterns with the linked tsconfig.json and src/BehaviorTree/btJsx.ts examples. Done means the page includes concrete, working examples for a custom JSX factory and a non-global namespace such as preact's h.JSX.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100