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

Cannot find name react. #58844

Closed
mrVin99 opened this issue Jun 12, 2024 · 10 comments
Closed

Cannot find name react. #58844

mrVin99 opened this issue Jun 12, 2024 · 10 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@mrVin99
Copy link

mrVin99 commented Jun 12, 2024

I'm getting an annoying error saying it "Cannot find name react." However, im not using React at all, i'm using SolidJS. Everything is working smoothly on Intellij IDEA.

image

@mrVin99
Copy link
Author

mrVin99 commented Jun 12, 2024

I figured out.
VSCode is unable to differentiate between index.ts and index.tsx. Changing index.ts to anything else made the problem go away.
Gonna leave this issue open because imo this is a bug.

@mjbvz mjbvz transferred this issue from microsoft/vscode Jun 12, 2024
@mjbvz mjbvz removed their assignment Jun 12, 2024
@iisaduan
Copy link
Member

Can you provide sample code/repro steps to help us investigate?

@RyanCavanaugh RyanCavanaugh added the Question An issue which isn't directly actionable in code label Jun 13, 2024
@RyanCavanaugh
Copy link
Member

It looks like this is a question rather than a bug report. This issue tracker is for tracking bugs and active work on TypeScript itself, rather than a general forum for programmers using TypeScript to get help or ask questions.

You can ask questions on sites like Stack Overflow. We are not able to provide one-on-one support on the issue tracker. Please read the issue template carefully - it has important information on what kinds of reports can be acted on here, as well as links to useful TypeScript resources. Thanks!

@RyanCavanaugh RyanCavanaugh closed this as not planned Won't fix, can't repro, duplicate, stale Jun 13, 2024
@mrVin99
Copy link
Author

mrVin99 commented Jun 13, 2024

It looks like this is a question rather than a bug report. This issue tracker is for tracking bugs and active work on TypeScript itself, rather than a general forum for programmers using TypeScript to get help or ask questions.

You can ask questions on sites like Stack Overflow. We are not able to provide one-on-one support on the issue tracker. Please read the issue template carefully - it has important information on what kinds of reports can be acted on here, as well as links to useful TypeScript resources. Thanks!

Respectfully i disagree, this is not a question, this is a issue. I'll provide an sample repository.

@fatcerberus
Copy link

If it’s a bug, you need to use the bug report template.

@mrVin99
Copy link
Author

mrVin99 commented Jun 13, 2024

@fatcerberus
@iisaduan
@RyanCavanaugh

Here:

https://github.com/mrVin99/vscode-issue-58844

Unless somehow its a problem within my vscode setup, you should be able to see. Install the dependencies (pnpm or npm) and just go to index.tsx, it should display the error msg. Change the index.ts to anything you want .ts, the error msg will dissapear.

image

@mrVin99
Copy link
Author

mrVin99 commented Jun 13, 2024

@fatcerberus @iisaduan @RyanCavanaugh

Here:

https://github.com/mrVin99/vscode-issue-58844

Unless somehow its a problem within my vscode setup, you should be able to see. Install the dependencies (pnpm or npm) and just go to index.tsx, it should display the error msg. Change the index.ts to anything you want .ts, the error msg will dissapear.

image

For reference, this is not a problem with intellij idea. So for this reason i believe this to be a bug.

image

@mrVin99
Copy link
Author

mrVin99 commented Jun 13, 2024

If it’s a bug, you need to use the bug report template.

Sorry about, should i create a new issue report or is the repository and explanation above good enough?

@RyanCavanaugh
Copy link
Member

RyanCavanaugh commented Jun 13, 2024

This is a misconfiguration. TypeScript won't automatically pick up two files with the same extension via include (this is intentional), so index.ts is part of your project and index.tsx isn't (thus index.tsx is in the inferred project which doesn't have any of the necessary jsx settings). You'll need to put index.tsx in the files array or otherwise modify your config if you want to do this.

@mrVin99
Copy link
Author

mrVin99 commented Jun 13, 2024

Didn't know it was intentional, since it worked on intellij. I'll look this up, thanks for the help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

5 participants