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

The presence of a jsxImportSource pragma or compiler option should implicitly include the types of the target module #40502

Closed
weswigham opened this issue Sep 11, 2020 · 2 comments · Fixed by #41330
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@weswigham
Copy link
Member

This is a followup for #39199. If the pragma or compiler option is present, we should append the values to the types we look up, to reduce the duplication required in the compiler options.

@ddprrt
Copy link

ddprrt commented Oct 13, 2020

Quick Q: Is this the issue addressing that once I add

{
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "preact",
    "strict": true
  }
}

to my compiler options, I get a JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.ts(7026) error, because TypeScript does not add the jsx-runtime types?

Is there a workaround for that at the moment?

@weswigham
Copy link
Member Author

weswigham commented Oct 13, 2020

Sorta, this issue is about automatically including import source types, but it does have a simple workaround - also add "types": ["react"] to your options.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants