deno: v0.35.0 TSX file can't be compiled
index.tsx
import React from "https://dev.jspm.io/react"
export default () => <html>deno</html>;
error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
► file:///Users/keroxp/src/deno/index.tsx:11:22
11 export default () => <html>deno</html>;
I know recently strict
option enabled by default for deno compiler but I couldn’t right way to define correct JSX
namespace for external resources.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 21 (12 by maintainers)
Fixed in Deno v1.0.3
I found it difficult to find the right imports and types to remove this error so fwiw here is a working example as of 2020-05-16.
@bardiarastin #5726 is published on deno v1.0.2 However, these code still report errors (but works fine on deno v1.0.0):
Similar to the OP, I import React from the jspm CDN.
The JSX, such as
<h1>Hello, World!</h1>
, gets rendered server-side (within Deno) to an HTML string and sent in a response using Deno’sstd/http
server.In the future, I will likely also try to use JSX for command line apps. Just need to make something like Ink for Deno.