Error - Cannot find name 'React'. Did you mean 'preact'? deno-ts(2552)
See original GitHub issueHello,
After updated to version 1.1 I started getting errors in my files. The first error was related to: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists
which I solved doing: https://github.com/lampewebdev/deno-jsx-test.
But now I got the error: Cannot find name 'React'. Did you mean 'preact'?
, which is very annoying. I tried to reopen VSCode many times but no luck.
If I start a project from scratch it does work: deno run -A -r https://fresh.deno.dev my-app
Any suggestion?
deno 1.25.0 (release, x86_64-pc-windows-msvc)
v8 10.6.194.5
typescript 4.7.4
deno.json:
{
"tasks": {
"start": "deno run -A --watch=static/,routes/ dev.ts"
},
"importMap": "./import_map.json",
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact"
}
}
.vscode/settings.json:
{
"deno.enable": true,
"deno.unstable": false,
"deno.lint": true,
"editor.defaultFormatter": "denoland.vscode-deno",
"deno.importMap": "./web/import_map.json",
"deno.config": "./web/tsconfig.json"
}
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:10
Top Results From Across the Web
Typescript - "Cannot find name" errors in React components
Typescript isn't expecting to see JSX in your Typescript file. The easiest way to resolve this is to rename your file from .ts...
Read more >TypeScript | Preact: Fast 3kb React alternative with the same ...
When you use Preact in a TypeScript-aware editor (like VSCode), you can benefit from the added type information while writing regular JavaScript.
Read more >React Typescript "Cannot find name" error [Solved] | bobbyhadz
To solve the "Cannot find name" error in React typescript, use a `.tsx` extension for the files in which you use JSX, set...
Read more >Intermediate TypeScript and React Handbook – How to Build ...
If you have no idea what strongly typed Polymorphic React components with Typescript means, that's fine. That's a decent pointer that this ...
Read more >Using React with TypeScript - Mattermost
Can't resolve './App'. If your React project doesn't yet know how to interpret TypeScript code, you may get the following error in your...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I got same error within new fresh project.
deno.json
@MoaathAlattas , changed and now got:
JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
.