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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug : Appwrite with typescript react app throws error #5706

Closed
2 tasks done
learncodingforweb opened this issue Jun 14, 2023 · 5 comments
Closed
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@learncodingforweb
Copy link

馃憻 Reproduction steps

  1. npm create vite@latest, create react app with typescript
  2. npm i appwrite
  3. create Appwriteapi.ts file with content
import { Client, Account } from "appwrite";

const client = new Client();

const account = new Account(client);

client
    .setEndpoint('http:https://localhost:8080/v1') // Your API Endpoint
    .setProject('6488a7219429fdf30941') // Your project ID
;

export {
    client,
    account
}

getting warning messages, without any typescript autocomplete.

Could not find a declaration file for module 'appwrite'. 'node_modules/appwrite/dist/esm/sdk.js' implicitly has an 'any' type.
There are types at '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.ts(7016)

馃憤 Expected behavior

resolve warning messages, so that typescript function can detect function details, like autocomplete

馃憥 Actual Behavior

Could not find a declaration file for module 'appwrite'. 'node_modules/appwrite/dist/esm/sdk.js' implicitly has an 'any' type.
There are types at '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.ts(7016)

warning messages, without function autocomplete exist in typescript.

馃幉 Appwrite version

Version 1.3.x

馃捇 Operating system

Linux

馃П Your Environment

using appwrite self hosting on ubuntu22.05 LTS
Linux notebook 5.19.0-43-generic #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon May 22 13:39:36 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

docker image

docker run -it --rm \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
    --entrypoint="install" \
    appwrite/appwrite:1.3.7

package.json

"dependencies": {
    "appwrite": "^11.0.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  }

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@learncodingforweb learncodingforweb added the bug Something isn't working label Jun 14, 2023
@TristonWasik
Copy link

I also having this issue with a fresh Vite react project

@TristonWasik
Copy link

I started a PR for this issue in the sdk repo

@joeyouss
Copy link

Thank you for the PR @TristonWasik , we will look into it ASAP.

@joeyouss joeyouss self-assigned this Jun 20, 2023
@joeyouss joeyouss changed the title Appwrite with typescript react app giving Could not find a declaration file for module 'appwrite'. '/node_modules/appwrite/dist/esm/sdk.js' implicitly has an 'any' type 馃悰 Bug : Appwrite with typescript react app throws error Jun 20, 2023
@joeyouss
Copy link

I have left a comment there on the PR @TristonWasik

@stnguyen90
Copy link
Contributor

Closing as a duplicate of appwrite/sdk-for-web#54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants