We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.tsx
4.2.0, 4.2.1
I am having this same issue for 4.2.0 and 4.2.1 using express and node in any tsx file in my project.
tsx
example:
type LinkProps = { class: string } & ( | { 'hx-get': string; } | { href: string; } ); export function Link({ class: className, children, ...rest }: Html.PropsWithChildren<LinkProps>) { const props = `href` in rest ? { ...rest, target: '_blank', rel: 'noopener noreferrer' } : rest; const ourClass = className ? className : 'link'; return ( <a class={ourClass} {...props}> {children} </a> ); }
Error at Html reported by typescript:
Cannot find namespace 'Html'.ts(2503) ⚠ Error(TS2503) | Cannot find namespace Html .
Error at {children}
{children}
Usage of xss-prone content without `safe` attribute. https://kitajs.github.io/ts-html-plugin#k601ts(0 K601) ⚠ Error Usage of xss-prone content without `safe` attribute. https://kitajs.github.io/ts-html-plugin#k601 (parameter) children: Html.PropsWithChildren<LinkProps>
mkdir nsamespace-bug cd namespace-bug touch index.tsx touch tsconfig.json npm init -y # ... your choices npm i -E [email protected] @kitajs/[email protected] @kitajs/[email protected]
type LinkProps = { class: string } & ( | { "hx-get": string; } | { href: string; } ); export function Link({ class: className, children, ...rest }: Html.PropsWithChildren<LinkProps>) { const props = `href` in rest ? { ...rest, target: "_blank", rel: "noopener noreferrer" } : rest; const ourClass = className ? className : "link"; return ( <a class={ourClass} {...props}> {children} </a> ); }
{ "compilerOptions": { "strict": true, "strictNullChecks": true, "module": "commonjs", "declaration": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, "target": "ES2021", "outDir": "./dist", "baseUrl": "./", "skipLibCheck": true, "jsx": "react-jsx", "jsxImportSource": "@kitajs/html", "plugins": [{ "name": "@kitajs/ts-html-plugin" }] } }
Namespace should be recognized in the file as it is if you install @kitajs/[email protected]
@kitajs/[email protected]
The text was updated successfully, but these errors were encountered:
You need to manually import it if you want to use types.
Sorry, something went wrong.
I'll see what I can do to replicate 4.1.0 behavior's, but its a problem with current's typescript version and the register.d.ts file.
However I don't have enough time for now, are you able to start a PR?
@kitajs/htm/register
arthurfiorette
Successfully merging a pull request may close this issue.
Prerequisites
Versions
4.2.0, 4.2.1
Description
I am having this same issue for 4.2.0 and 4.2.1 using express and node in any
tsx
file in my project.example:
Error at Html reported by typescript:
Error at
{children}
Steps to Reproduce
Create a project
Expected Behavior
Namespace should be recognized in the file as it is if you install
@kitajs/[email protected]
The text was updated successfully, but these errors were encountered: