-
Notifications
You must be signed in to change notification settings - Fork 12.8k
/* @jsxImportSource foo */ comment works only sometimes. #41985
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
Comments
Reproduction:https://github.com/trusktr/typescript-issue-41985 git clone git@github.com:trusktr/typescript-issue-41985.git
cd typescript-issue-41985
npm install
npx tsc --noEmit // outputs the error to console Output:
|
Live in-browser reproduction on Gitpod (requires a free Gitpod account): http://gitpod.io/#https://github.com/trusktr/typescript-issue-41985 Run the same shell commands in the terminal in the in-browser editor. |
In case anyone reads by email, I updated the reproduction: I accidentally pushed it up with a dependency on |
I found the mistake: the |
This issue has been marked as 'Question' and has seen no recent activity. It has been automatically closed for house-keeping purposes. If you're still waiting on a response, questions are usually better suited to stackoverflow. |
This further supports the idea that
Confusing! |
I've been trying to get JSX working without using global
JSX
types, and I have no luck so far.First, I tried #41813, but
import
doesn't do the trick (you think it would because ES Module syntax is the standard way to import things).Because that didn't work, now I'm trying to use
/* @jsxImportSource solid-js */
comments to importJSX
in specific files where I need solid's JSX (f.e. the project may one JSX lib in some files, and another JSX lib in other files).I was able to get
@jsxImportSource
working in this simple example (npm install && npx tsc --noEmit
succeeds with no type errors).But in another project, I'm trying to use the same
/* @jsxImportSource solid-js */
syntax, and theJSX
namespace is still invisible to the JSX expressions.The only way I can get it to work, in that project, is by placing
"jsxImportSource": "solid-js"
inside oftsconfig.json
, but that's not what I want, because I want to use different forms of JSX in different files.I'm using
"jsx": "preserve"
intsconfig.json
and compile JSX for each of the files aftertsc
.TypeScript Version: 4.1.3
Search Terms:
site:github.com typescript "jsxImportSource"
Code
My code in the project where
/* @jsxImportSource solid-js */
does not work looks like this:Expected behavior:
The JSX expression should work because, not only have I
import {JSX} from 'solid-js'
, but I also/* @jsxImportSource solid-js */
Actual behavior:
I get this error on the
<div />
:Playground Link:
I would try to provide a playground link, but as described in microsoft/TypeScript-Website#1427, playground appears to not have been updated so that it installs dependencies based on
/* @jsxImportSource
comments.Here is my attempt, which is unable to find the
solid-js/jsx-runtime
import:playground link
The text was updated successfully, but these errors were encountered: