question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error - Cannot find name 'React'. Did you mean 'preact'? deno-ts(2552)

See original GitHub issue

Hello,

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"
}

Screenshot 2022-09-22 185608

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:10

github_iconTop GitHub Comments

1reaction
ryota-murakamicommented, Oct 24, 2022

I got same error within new fresh project.

deno.json

{
  "tasks": {
    "start": "deno run -A --watch=static/,routes/ dev.ts",
    "lint": "deno lint",
    "fmt": "deno fmt"
  },
  "importMap": "./import_map.json",
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "preact"
  }
}


Screen Shot 2022-10-24 at 23 36 09
1reaction
gmunumelcommented, Sep 25, 2022

@MoaathAlattas , changed and now got: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists..

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found