solana-mobile / mobile-wallet-adapter

Other
223 stars 91 forks source link

Could not find a declaration file for module #876

Open jayeshbhole opened 1 week ago

jayeshbhole commented 1 week ago

Describe the bug Hey. I am working on a simple setup to write a package. After importing @solana-mobile/wallet-adapter-mobile the following error is thrown while building the project

Could not find a declaration file for module '@solana-mobile/wallet-adapter-mobile'. '/Users/.../Documents/GitHub/Work/solana-react/node_modules/.pnpm/@solana-mobile+wallet-adapter-mobile@2.1.3_@solana+web3.js@1.93.0_bufferutil@4.0.8_utf-8-vali_zmsbdydrbudvytyku74jwk3dfa/node_modules/@solana-mobile/wallet-adapter-mobile/lib/esm/index.js' implicitly has an 'any' type.
  There are types at '/Users/.../Documents/GitHub/Work/solana-react/node_modules/@solana-mobile/wallet-adapter-mobile/lib/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The '@solana-mobile/wallet-adapter-mobile' library may need to update its package.json or typings.ts(7016)

To Reproduce Steps to reproduce the behavior:

  1. Setup a bare react project with pnpm v9.4.0 and node v20.15.0. I'm using the following configs:
    
    .eslintrc.cjs
    -------------

module.exports = { root: true, env: { browser: true, es2020: true }, extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended'], ignorePatterns: ['dist', '.eslintrc.cjs'], parser: '@typescript-eslint/parser', plugins: ['react-refresh'], rules: { 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], '@typescript-eslint/no-explicit-any': 'warn', }, };

tsconfig.json

{ "compilerOptions": { "composite": true, "declaration": true, "noEmit": false, "sourceMap": true, "outDir": "dist/_esm", "rootDir": "./src", "module": "NodeNext", "moduleResolution": "NodeNext", "allowJs": false, "allowSyntheticDefaultImports": true, "esModuleInterop": false, "forceConsistentCasingInFileNames": true, "isolatedModules": true, "jsx": "react-jsx", "lib": ["DOM", "DOM.Iterable", "ESNext"], "noFallthroughCasesInSwitch": true, "resolveJsonModule": true, "skipLibCheck": true, "strict": true, "target": "ES2020" }, "include": ["./src//*", "./src/*/.json"], "exclude": ["/.*/", "/build", "/dist", "node_modules", ".yarn"] }

package.json

{ "name": "...", "private": true, "version": "0.0.0", "type": "module", "scripts": { "watch": "tsc -w -p ./tsconfig.json", "build": "tsc --build" }, "dependencies": { "@solana-mobile/wallet-adapter-mobile": "^2.1.3", "@solana/wallet-adapter-base": "^0.9.23", "@solana/wallet-standard-wallet-adapter-react": "^1.1.2", "@solana/web3.js": "^1.91.2", "@tanstack/react-query": "^5.44.0", "react": "^18.2.0", "react-dom": "^18.2.0", "zustand": "^4.5.2" }, "devDependencies": { "@types/react": "^18.2.66", "@types/react-dom": "^18.2.22", "@typescript-eslint/eslint-plugin": "^7.2.0", "@typescript-eslint/parser": "^7.2.0", "eslint": "^8.57.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.6", "prettier-plugin-organize-imports": "^3.2.4", "typescript": "^5.2.2" }, "peerDependencies": { "react": "^18.2.0", "react-dom": "^18.2.0" } }


2. Import a few things from the package.

import { createDefaultAddressSelector, createDefaultAuthorizationResultCache, createDefaultWalletNotFoundHandler, SolanaMobileWalletAdapter, SolanaMobileWalletAdapterWalletName, } from '@solana-mobile/wallet-adapter-mobile';



3. Run `pnpm build`.

**Environment:**
 - pnpm: v9.4.0
 - node: v20.15.0
sdlaver commented 1 week ago

@Funkatronics would you mind taking a look at this?

ryoid commented 1 day ago

Might be related to https://github.com/solana-mobile/mobile-wallet-adapter/pull/841, you can try to patch the package.json locally while waiting for npm release.