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

Cannot find namespace 'JSX'. #53

Closed
gretzke opened this issue Apr 29, 2021 · 5 comments
Closed

Cannot find namespace 'JSX'. #53

gretzke opened this issue Apr 29, 2021 · 5 comments

Comments

@gretzke
Copy link
Contributor

gretzke commented Apr 29, 2021

Error: node_modules/use-nft/dist/core.d.ts:6:5 - error TS2503: Cannot find namespace 'JSX'.

6 }): JSX.Element;
      ~~~

Somehow the @types/react dependency is lost when installing the package. This seems to be the same issue.

It can be solved by installing @types/react manually in the project.

@bpierre
Copy link
Owner

bpierre commented Apr 29, 2021

Ah, it must be because JSX is not explicitly imported. I moved to an explicit import of React.FC here: #54

Would you mind trying with this branch, and let me know if it works without adding @types/react to the project? Thanks 🙏

@bpierre
Copy link
Owner

bpierre commented May 5, 2021

@gretzke I just published 0.6.1 with this change, so I am closing this issue for now. Please reopen if you can reproduce with the latest version!

@bpierre bpierre closed this as completed May 5, 2021
@gretzke
Copy link
Contributor Author

gretzke commented May 5, 2021

Sorry I was a bit busy recently, when I tried adding the branch as a dependency in package.json the node_modules folder was empty. Unfortunately I didn't have the time to further investigate. I'll try 0.6.1 soon and if I encounter a problem I'll reopen

@bpierre
Copy link
Owner

bpierre commented May 5, 2021

Cool no worries, thanks!

@gretzke
Copy link
Contributor Author

gretzke commented May 6, 2021

JSX fix works now, but I think there is a similar issue with ethers, I recently from ethers to web3js and now I get this error during compilation:

Error: node_modules/use-nft/dist/fetchers/ethers/types.d.ts:1:31 - error TS2307: Cannot find module '@ethersproject/contracts' or its corresponding type declarations.

1 import type { Contract } from "@ethersproject/contracts";
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~


Error: node_modules/use-nft/dist/fetchers/ethers/types.d.ts:2:52 - error TS2307: Cannot find module '@ethersproject/providers' or its corresponding type declarations.

2 import type { BaseProvider, JsonRpcProvider } from "@ethersproject/providers";
                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~

installing ethers as a dev dependency fixes the issue again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants