You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReactfrom"https://esm.sh/[email protected]";constApp=()=>{return<h1>Hello from JSX</h1>;};console.log(App());
this project is running as expected with no errors, But if I use this line:
importReactfrom"react";
I get the following error on H1 tags:
JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.deno-ts(7026)
⚠ Error (TS7026) |
JSX element implicitly has type any because no interface JSX.IntrinsicElements exists.
I tried adding @types/react package, then no error was showed however when running the program I get this error:
error: Could not resolve 'npm:@types/[email protected]'.
Caused by:
[ERR_INVALID_PACKAGE_TARGET] Invalid "exports" main target {"types@<=5.0":{"default":"./ts5.0/index.d.ts"},"types":{"default":"./index.d.ts"}} defined in the package config /home/warcayac/.cache/deno/npm/registry.npmjs.org/@types/react/18.3.12/package.json imported from 'file:///home/warcayac/DataDisk/Projects/Programming/Deno/_tutorials/MoonHighway/deno-2-course/11-typescript-and-jsx-in-deno/App.tsx'; target must start with "./"
I don't know what's happening. Any ideas?
The text was updated successfully, but these errors were encountered:
@jarrodu@warcayac This options is works for JSX but is it works for import {} from 'react';?
For example I want to use hooks like useState but as I mentioned here I can't use imports from react because Deno 2 does not sees types for React NPM-package
I have a Deno 2 project with these files:
deno.json
App.tsx
this project is running as expected with no errors, But if I use this line:
I get the following error on H1 tags:
I tried adding @types/react package, then no error was showed however when running the program I get this error:
I don't know what's happening. Any ideas?
The text was updated successfully, but these errors were encountered: