Open believer opened 1 year ago
Hey @believer, I'm maintaining a fork (https://github.com/kitajs/html) which already has summary
support.
This library seems to be unmaintained, (no license, #23, no fragment support...) I'm maintaining @kitajs/html with some extra features I wanted to add, like fragments, more performant, a pre-compiled mode, null/undefined handling, preact (h
) build systems compatible and more...
I'm open to creating a PR to this repo if requested.
@arthurfiorette Hey! Thanks for creating your fork, it works great. I had to adjust the getting started steps slightly to get it working (it might be because I'm using Bun?).
The steps are similar to the getting started steps in typed-html
:
// tsconfig.json
{
"compilerOptions": {
"jsx": "react",
"jsxFactory": "elements.createElement"
}
}
// Use in file
import * as elements from '@kitajs/html'
@believer thanks for your heads up! Things should now be fixed at v1.3.1
.
P.S: I think you should now be able to go back to the README setup, as the example above will not works with fragments :)
@arthurfiorette Thanks for the quick update, but I still can't get it to work. If I only use jsx
and reactNamespace
in tsconfig.json
from the README I get Can't find variable: React
when I try to run the app. Adding the optional options makes no difference.
My entire tsconfig
, which came from running bun init
, looks like:
{
"compilerOptions": {
"lib": ["ESNext"],
"module": "esnext",
"target": "esnext",
"moduleResolution": "bundler",
"moduleDetection": "force",
"allowImportingTsExtensions": true,
"strict": true,
"downlevelIteration": true,
"skipLibCheck": true,
"jsx": "react",
"reactNamespace": "html",
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"allowJs": true,
"noEmit": true,
"types": [
"bun-types" // add Bun global
]
}
}
Maybe there's some other option here that's conflicting?
Edit: Ok, it worked with:
// tsconfig.json
{
"compilerOptions": {
"jsx": "react",
"reactNamespace": "elements",
"jsxFactory": "elements.createElement",
"jsxFragmentFactory": "elements.Fragment",
}
}
// Use in file
import elements from '@kitajs/html'
But not if I call it html
or remove jsxFactory
/jsxFragmentFactory
😅
The
summary
tag seems to be missing in the intrinsic elements' definition. This is used together withdetails
, which does exist in the definitions.I can create a PR if the issue is valid. I think there's only a
summary: HtmlTag;
missing, since thesummary
tag only includes the global attributes.Thanks for a great library!