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

Unable to import Javascript files from TSX #5900

Closed
r-tae opened this issue May 27, 2020 · 9 comments · Fixed by #5817
Closed

Unable to import Javascript files from TSX #5900

r-tae opened this issue May 27, 2020 · 9 comments · Fixed by #5817
Assignees
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@r-tae
Copy link
Contributor

r-tae commented May 27, 2020

Minimal reproducible example is:

// in mod.tsx
import foo from "./foo.js";

Regardless of whether or not foo.js exists, this yields error: TS2307 [ERROR]: Cannot find module './foo.js' or its corresponding type declarations.

Behaviour exists when trying to import either .js or .jsx from .tsx and not from any other permutation.

Is this simply a bad error message covering up a case where it expects me to specify a type file?

@bartlomieju
Copy link
Member

@actual-size thanks for opening the issue; definitely a bug introduced in #5029

@bartlomieju bartlomieju self-assigned this May 27, 2020
@bartlomieju bartlomieju added bug Something isn't working correctly cli related to cli/ dir labels May 27, 2020
@bartlomieju
Copy link
Member

@actual-size I just tried testing this problem but I'm unable to repeat the problem. Can you provide reproduction that causes this error?

@r-tae
Copy link
Contributor Author

r-tae commented May 29, 2020

@bartlomieju Just tried the following steps:

❯❯❯ echo "import foo from './foo.js'" > testfile.tsx
❯❯❯ deno run testfile.tsx
Compile file:///Users/river/Desktop/testfile.tsx
error: TS2307 [ERROR]: Cannot find module './foo.js' or its corresponding type declarations.
import foo from './foo.js'
                ~~~~~~~~~~
    at file:///Users/river/Desktop/testfile.tsx:1:17
❯❯❯ echo "import foo from './foo.ts'" > testfile.working.tsx     ✘ 1 
❯❯❯ deno run testfile.working.tsx                                                                  ✘ 1 
Compile file:///Users/river/Desktop/testfile.working.tsx
❯❯❯

@r-tae
Copy link
Contributor Author

r-tae commented May 29, 2020

deno --version gives me:

deno 1.0.1
v8 8.4.300
typescript 3.9.2

@bartlomieju
Copy link
Member

@actual-size can you try with Deno v1.0.2? I fixed some problems related to TSX between 1.0.1 and 1.0.2

@r-tae
Copy link
Contributor Author

r-tae commented May 29, 2020

Sorry, still happening with v1.0.2

@apiel
Copy link

apiel commented May 29, 2020

I have similar issue: error: TS2307 [ERROR]: Cannot find module '../jsx' or its corresponding type declarations. import { node } from '../jsx';

@bartlomieju
Copy link
Member

@actual-size thanks, now I can confirm that it's broken. However I tried it with changes from #5817 and it works fine.

@r-tae
Copy link
Contributor Author

r-tae commented May 29, 2020

Great to hear, thanks for your help!

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.

3 participants