denoland / deno

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

"message": "JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.", "source": "deno-ts", "startLineNumber": 16, "startColumn": 13, "endLineNumber": 16, "endColumn": 28 }] #23339

Closed Parpecito closed 5 months ago

Parpecito commented 5 months ago

Version: Deno 1.42.3

Captura image

CalvinWilkinson commented 5 months ago

I am having the same issue.

What fixed it for me was downgrading from version 1.42.3 to version 1.42.2.

I did indeed update deno yesterday to '1.42.3. Since that was the only change that I made, I figured I would try it and it worked.

CalvinWilkinson commented 5 months ago

Also, I am not seeing any related issues in the deno fresh repository. 🤷🏻

nayeemrmn commented 5 months ago

@Parpecito @CalvinWilkinson @ynwd Can you share your deno.jsons? And import map if it's a separate file.

ynwd commented 5 months ago
Screenshot 2024-04-13 at 06 40 14
ynwd commented 5 months ago
{
  "lock": false,
  "lint": {
    "exclude": ["static"],
    "rules": {
      "tags": ["recommended"]
    }
  },
  "fmt": {
    "exclude": [".fastro", "static"]
  },
  "imports": {
    "@app/": "./",
    "@preact/signals": "https://esm.sh/*@preact/signals@1.2.3",
    "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.6.0",
    "fastro/": "https://fastro.deno.dev/v0.88.3/",
    "preact": "https://esm.sh/preact@10.20.2",
    "preact/": "https://esm.sh/preact@10.20.2/",
    "std/": "https://deno.land/std@0.222.0/",
    "tailwindcss": "npm:tailwindcss@3.4.3",
    "tailwindcss/": "npm:/tailwindcss@3.4.3/",
    "tailwindcss/plugin": "npm:/tailwindcss@3.4.3/plugin.js"
  },
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "preact"
  },
  "nodeModulesDir": true
}
tanquar commented 5 months ago

same issue with me.

To clear the warnings I tried adding /** @jsxImportSource preact */ in every single .tsx and worked, as noted here: https://docs.deno.com/runtime/manual/advanced/jsx_dom/jsx My project is Fresh 1.6.8, using deno 1.42.2, vscode. deno.json includes jsxImportSouce:

  "imports": {
    "$fresh/": "https://deno.land/x/fresh@1.6.8/",
    "preact": "https://esm.sh/preact@10.19.6",
    "preact/": "https://esm.sh/preact@10.19.6/",
...
  "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" }

but this does not contribute to clearing the warnings.

j-Cis commented 5 months ago

I had the same problem, after inserting the following 3 lines in each component, the problem disappears.

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

But another one appears, following the repair of that one.

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
  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...
cdoremus commented 5 months ago

I was getting a bunch of JSX errors in my Fresh v1.6.8 app using Deno v1.42.3. When I downgraded the Deno version to 1.42.2 they went away.

nayeemrmn commented 5 months ago

The fix is available in deno upgrade --canary, please try it out.

cdoremus commented 5 months ago

I tried the canary build and the JSX errors went away in each of my two main Fresh apps.

CalvinWilkinson commented 5 months ago

@Parpecito @CalvinWilkinson @ynwd Can you share your deno.jsons? And import map if it's a separate file.

Sure thing. I am not using an import map.

deno.json

{
  "lock": false,
  "tasks": {
    "check": "deno fmt --check && deno lint && deno check **/*.ts && deno check **/*.tsx",
    "cli": "echo \"import '\\$fresh/src/dev/cli.ts'\" | deno run --unstable -A -",
    "manifest": "deno task cli manifest $(pwd)",
    "start": "deno run -A --unstable-kv --env=./.env.dev.local --watch=static/,routes/ dev.ts",
    "build": "deno run -A --unstable-kv dev.ts build",
    "preview": "deno run -A --unstable-kv main.ts",
    "update": "deno run -A -r https://fresh.deno.dev/update ."
  },
  "lint": { "rules": { "tags": ["fresh", "recommended"] } },
  "exclude": ["**/_fresh/*"],
  "imports": {
    "$fresh/": "https://deno.land/x/fresh@1.6.8/",
    "preact": "https://esm.sh/preact@10.19.6",
    "preact/": "https://esm.sh/preact@10.19.6/",
    "@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
    "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1",
    "tailwindcss": "npm:tailwindcss@3.4.1",
    "tailwindcss/": "npm:/tailwindcss@3.4.1/",
    "tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js",
    "$std/": "https://deno.land/std@0.216.0/",
    "@supabase": "https://esm.sh/@supabase/supabase-js@2",
    "@supabase/": "https://esm.sh/@supabase/supabase-js@2/"
  },
  "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" },
  "nodeModulesDir": true
}