Skip to content

Checking JSX elements ignores JSX.IntrinsicElements declared using template literal index signatures #55240

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

Closed
Andarist opened this issue Aug 2, 2023 · 0 comments Β· Fixed by #55245
Labels
Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases

Comments

@Andarist
Copy link
Contributor

Andarist commented Aug 2, 2023

Bug Report

πŸ”Ž Search Terms

JSX IntrinsicElements template literal types index signatures

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

declare const React: unknown

declare namespace JSX {
    export interface IntrinsicElements {
        [elemName: `test${string}`]: {}
    }
}

;<testfoo /> // Property 'testfoo' does not exist on type 'JSX.IntrinsicElements'.(2339)

πŸ™ Actual behavior

An error is reported claiming that testfoo does not exist on type JSX.IntrinsicElements

πŸ™‚ Expected behavior

I'd expect that index signature to permit this JSX element.

@RyanCavanaugh RyanCavanaugh added the Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases label Aug 4, 2023
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Possible Improvement The current behavior isn't wrong, but it's possible to see that it might be better in some cases
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants