WalletConnect / modal

WalletConnectModal repository
https://lab-walletconnect-modal.pages.dev/
Apache License 2.0
18 stars 15 forks source link

[bug] tsc compiling issue during wrong import path in `modal-core` #34

Open mojtabast opened 2 months ago

mojtabast commented 2 months ago

Link to minimal reproducible example

https://github.com/mojtabast/wc-modal-import-issue

Summary

@walletconnect/modal build artifacts has a incorrect import from an absolute path which can not be resolved.

If you take a look at this path @walletconnect/modal/dist/_types/src/client.d.ts you will see an import import("packages/modal-core/dist/_types/src/controllers/ModalCtrl"). it should be @walletconnect/modal-core/dist/_types/src/controllers/ModalCtrl to problem goes away.

there are actually two error in this file. this is the actual error:

node_modules/@walletconnect/modal/dist/_types/src/client.d.ts:12:34 - error TS2307: Cannot find module 'packages/modal-core/dist/_types/src/controllers/ModalCtrl' or its corresponding type declarations.

12     openModal: (options?: import("packages/modal-core/dist/_types/src/controllers/ModalCtrl").OpenOptions | undefined) => Promise<void>;
                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@walletconnect/modal/dist/_types/src/client.d.ts:14:50 - error TS2307: Cannot find module 'packages/modal-core/dist/_types/src/types/controllerTypes' or its corresponding type declarations.

14     subscribeModal: (callback: (newState: import("packages/modal-core/dist/_types/src/types/controllerTypes").ModalCtrlState) => void) => () => void;
                                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found 2 errors in the same file, starting at: node_modules/@walletconnect/modal/dist/_types/src/client.d.ts:12

You can test with my repo. It seems other people is facing with same issue as well.

List of related npm package versions

"dependencies": { "@walletconnect/modal": "2.6.2" }, "devDependencies": { "typescript": "5.5.4" },