Back

but this result could not be resolved when respecting package.json

  • 1
  • General
  • Web
Nimit Savant
7 May, 2023, 12:10

The error

TypeScript
  Could not find a declaration file for module 'appwrite'. 'c:/Users/ASUS/OneDrive/Desktop/my-vue-app/node_modules/appwrite/dist/esm/sdk.js' implicitly has an 'any' type.
  There are types at 'c:/Users/ASUS/OneDrive/Desktop/my-vue-app/node_modules/appwrite/types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'appwrite' library may need to update its package.json or typings.

tsconfig.json

TypeScript
{
  "compilerOptions": {
    "target": "ESNext",
    "lib": ["DOM", "DOM.Iterable", "ESNext"],
    "module": "ESNext",
    "skipLibCheck": true,

    /* Bundler mode */
    "moduleResolution": "bundler",
    "allowImportingTsExtensions": true,
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx",

    /* Linting */
    "strict": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "noFallthroughCasesInSwitch": true
  },
  "include": ["src"],
  "references": [{ "path": "./tsconfig.node.json" }]
}
TL;DR
The user is experiencing an error related to module resolution in TypeScript when using the Appwrite SDK. They have mentioned that changing the `moduleResolution` option in the `tsconfig.json` file to `"bundler"` is causing the issue. They have also provided a link to a GitHub issue related to this problem. The user has made a pull request on GitHub and asked if they can create a GitHub issue for this. There is no specific solution mentioned in the thread.
Nimit Savant
7 May, 2023, 12:10

Why can't ts deted the types in appwrite?

Nimit Savant
7 May, 2023, 12:57

If the tsconfig has moduleResolution: "bundler" it doesn't support appwrite types

Drake
7 May, 2023, 14:47

So if you change it to node, it works?

Drake
7 May, 2023, 14:48

What version of the Appwrite SDK did you install?

Drake
7 May, 2023, 14:53

Would you be able to create a GitHub issue for this?

Nimit Savant
7 May, 2023, 15:04

sure :)

Nimit Savant
7 May, 2023, 15:04

Yes works like a charm

Nimit Savant
7 May, 2023, 15:05

11.0.0

Nimit Savant
7 May, 2023, 15:14
Drake
7 May, 2023, 15:15

Thanks. After googling a bit it seems like this might be a newer typescript config and we can get it to work if we update a few things in the sdk. Thanks so much for bringing this to our attention! 🙏

Nimit Savant
7 May, 2023, 15:42

lemme know if I can drop a PR for this?

Drake
7 May, 2023, 15:53
Nimit Savant
7 May, 2023, 15:53

hehe its ok :)

Nimit Savant
7 May, 2023, 15:53

The issue getting solved is more important, thanks :)

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more