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
Check file:///home/misogohan/repro/component.tsx
error: TS7026 [ERROR]: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
const App = () => <h1>Hello, world!</h1>;
~~~~
at file:///home/misogohan/repro/component.tsx:1:19
TS7026 [ERROR]: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
const App = () => <h1>Hello, world!</h1>;
~~~~~
at file:///home/misogohan/repro/component.tsx:1:36
Found 2 errors.
However, I can dispense with these errors when I use https://esm.sh/preact instead of react.
Cause
With the new JSX transforms, TypeScript implicitly looks up https://esm.sh/react/jsx-runtime, but because its response header does not include X-TypeScript-Types, Deno cannot find the type declaration file of it, and TypeScript cannot resolve JSX namespace.
It might be that if url + '/index.d.ts' does not exist, it assumes there isn't a types file for it. I found another module that it was able to add x-typescript-types header for sub modules. https://esm.sh/@heroicons/[email protected]/outline
It's types was https://esm.sh/@heroicons/[email protected]/outline/index.d.ts.
Maybe having it fallback to checking '.d.ts' would be a reasonable solution that would resolve the issue of it not being able to get the types for these react submodules.
Case
I knew that Deno 1.16 supports new JSX transforms, and have tried it with https://esm.sh/react.
Minimum code:
After running
deno run
, I got this:However, I can dispense with these errors when I use https://esm.sh/preact instead of react.
Cause
With the new JSX transforms, TypeScript implicitly looks up https://esm.sh/react/jsx-runtime, but because its response header does not include
X-TypeScript-Types
, Deno cannot find the type declaration file of it, and TypeScript cannot resolveJSX
namespace.cf. https://esm.sh/preact/jsx-runtime has
X-TypeScript-Types
header, and such errors does not occur.Solution
I confirmed that there is the type declaration at https://cdn.esm.sh/v58/@types/react/jsx-runtime.d.ts. So just to link it, I guess.
Additional info
The text was updated successfully, but these errors were encountered: