Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ deno-types + import map does not resolve JSX types. #5815

Closed
AkifumiSato opened this issue May 24, 2020 · 0 comments · Fixed by #5817
Closed

@ deno-types + import map does not resolve JSX types. #5815

AkifumiSato opened this issue May 24, 2020 · 0 comments · Fixed by #5817
Assignees
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@AkifumiSato
Copy link
Contributor

deno: v1.0.0
MacOS: 10.14.6

It works by importing React from URL and specifying @ deno-types.

// @deno-types="https://deno.land/x/types/react/v16.13.1/react.d.ts"
import React from 'https://dev.jspm.io/react@16.13.1'

const App = () => (
  <div>
    <h1>Hello DenoLand!</h1>
  </div>
)

export default App

However, if you specify React in the import map, a compile error will occur.

// import_map.json
{
  "imports": {
    "React": "https://dev.jspm.io/react@16.13.1"
  }
}
// @deno-types="https://deno.land/x/types/react/v16.13.1/react.d.ts"
import React from 'React'

const App = () => (
  <div>
    <h1>Hello DenoLand!</h1>
  </div>
)

export default App

console

error: TS7026 [ERROR]: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
  <div>
  ~~~~~
    at file:///Users/satouakifumi/work/git/demo/deno-http/App.tsx:5:3

TS7026 [ERROR]: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
    <h1>Hello DenoLand!</h1>
    ~~~~
    at file:///Users/satouakifumi/work/git/demo/deno-http/App.tsx:6:5

TS7026 [ERROR]: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
    <h1>Hello DenoLand!</h1>
                       ~~~~~
    at file:///Users/satouakifumi/work/git/demo/deno-http/App.tsx:6:24

TS7026 [ERROR]: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.
  </div>
  ~~~~~~
    at file:///Users/satouakifumi/work/git/demo/deno-http/App.tsx:7:3

Found 4 errors.
@bartlomieju bartlomieju added bug Something isn't working correctly cli related to cli/ dir labels May 24, 2020
@bartlomieju bartlomieju self-assigned this May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants