Skip to content

Incorrect/unhelpful error message for non-module jsx fileΒ #64438

Description

πŸ”Ž Search Terms

non-module, script, jsx, jsxImportSource

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about jsx

⏯ Playground Link

No response

πŸ’» Code

const x = <><div>hi</div></>

πŸ™ Actual behavior

This JSX tag requires the module path '@solidjs/web/jsx-runtime' to exist, but none could be found. Make sure you have types for the appropriate package installed.ts(2875)
JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.ts(7026)

πŸ™‚ Expected behavior

I do have that package installed. The error message should give the real issue which is that scripts can't import modules.

Additional information about the issue

workaround: export {}

Activity

  1. DanielRosenwasser commented on Sep 24, 2026

    @DanielRosenwasser
    Member

    The suggestion is valid - but I've also noticed that the Solid docs use "jsx": "preserve".

    Under "jsx": "react-jsx", we automatically force JSX files into module mode. The only way to get something closer to this is by specifying "moduleDetection": "force". That might be something to suggest for their docs if you feel like it's appropriate.

  2. sh011 commented on Sep 25, 2026

    @sh011

    Hi Caleb Eggensperger (@calebegg) Daniel Rosenwasser (@DanielRosenwasser) I went through the issue and found that the diagnostic chain needs to be looked up properly. I would like to work on this issue, can you please assign it to me. Thanks!

  3. SiddhantShedge45 commented on Sep 30, 2026

    @SiddhantShedge45

    Hi Caleb Eggensperger (@calebegg) maintainers, I’d like to work on this issue.

    I’ve reviewed the reproduction and would like to investigate how the current JSX diagnostic is generated for non-module JSX files. I can work on improving the error message, adding the appropriate regression test, and verifying that the existing behavior for valid module-based JSX remains unchanged.

    If this issue is still available, I’d be happy to take it up and submit a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions