denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.77k stars 5.22k forks source link

JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists. || pragmaFrag cannot be set when runtime is automatic #24316

Open j-Cis opened 4 months ago

j-Cis commented 4 months ago

I have a problem, VSCode highlights all preact/html elements in red as an error. JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

err1-Snipaste_2024-04-14_08-58-53

I noticed that if I add these 3 lines to each element, the problem of highlighting the error disappears, but then this creates another problem, this time with compilation.

/** @jsx h */
/** @jsxFrag Fragment */
import { h, Fragment } from "preact";

err2-Snipaste_2024-04-14_09-05-20

Watcher File change detected! Restarting!
error: Uncaught (in promise) TypeError: pragma cannot be set when runtime is automatic at file:///A:/_CODE/SVG_DENO/svg-chart-family/routes/index.tsx:1:1

pragmaFrag cannot be set when runtime is automatic at file:///A:/_CODE/SVG_DENO/svg-chart-family/routes/index.tsx:2:1
  const manifest = (await import(toFileUrl(join(dir, "fresh.gen.ts")).href))
                    ^
    at async dev (https://deno.land/x/fresh@1.6.8/src/dev/dev_command.ts:38:21)
    at async file:///A:/_CODE/SVG_DENO/svg-chart-family/dev.ts:8:1
Watcher Process failed. Restarting on file change...

This problem was also noticed in deno: https://github.com/denoland/deno/issues/23339

nayeemrmn commented 4 months ago

This is fixed now, try deno upgrade --canary.

nickguimond commented 3 months ago

This was a problem for me because I had all my repositories in a shared workspace. As soon as I opened my Deno fresh app in a single vscode workspace the problem went away.