Skip to content
New issue

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

Unexpected error message when trying to extend JSX.IntrinsicElements in Hono #28564

Open
zachauten opened this issue Mar 20, 2025 · 1 comment

Comments

@zachauten
Copy link
Contributor

Version: Deno 2.1.4

Apologies if i'm overlooking something obvious! I'm trying to extend JSX.IntrinsicElements in Hono.

I have the following code:

import { JSX } from "hono/jsx";

type ButtonProps =  JSX.IntrinsicElements["button"];

interface ButtonPropsInterface extends ButtonProps {};

// An interface can only extend an identifier/qualified-name with optional type arguments.deno-ts(2499)
interface ButtonPropsInterface2 extends JSX.IntrinsicElements["button"] {
}

Code using ButtonPropsInterface runs fine, but ButtonPropsInterface2 gives a Typescript error. As far as I can tell, the ButtonHTMLAttributes referenced by JSX.IntrinsicElements["button"] doesn't have type arguments, so I don't see why this would be an issue. Why doesn't the compiler complain when I extend the alias, should extending JSX.IntrinsicElements["button"] be prohibited and I'm just tricking it?

Thanks!

@WWRS
Copy link

WWRS commented Mar 20, 2025

Likely related to microsoft/TypeScript#31843

I get the same error when running this code with npx tsc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants