appwrite / sdk-for-web

[READ-ONLY] Official Appwrite Web SDK 🧑

Home Page:https://appwrite.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ› Bug Report: We should remove top level `types` field in `package.json`.

Lalit3716 opened this issue Β· comments

commented

πŸ‘Ÿ Reproduction steps

  1. Initialize a TypeScript project with moduleResolution: "bundler" in your tsconfig.
  2. Install appwrite web sdk.
  3. Try to import it you will see that for the sdk, types will be undefined.

This is due to the fact that for TypeScript to work with packages that have exports field when using the new moduleResolution: node16/nodenext/bundler settings. When those are not used then TypeScript just ignores package.json#exports - but when you make it aware of exports by using those options then it requires the types to be included in exports and not as the top-level key of package.json.

You can also visit this tool to check that the types for this sdk are definitely wrong: https://arethetypeswrong.github.io/.

πŸ‘ Expected behavior

Types should be well defined.

πŸ‘Ž Actual Behavior

Types aren't well defined with moduleResolution: "bundler" option on in your tsconfig.json.

🎲 Appwrite version

Version 0.10.x

πŸ’» Operating system

Linux

🧱 Your Environment

No response

πŸ‘€ 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?

commented

I found this issue when working on something for the ongoing appwrite hackathon πŸ˜… and I know how to fix it as well but I am not sure where to open the PR since this is a READ ONLY repository.

@Lalit3716 do you have a way to patch this for the time being? running into this issue as well and id love work around

commented

Yeah for the time being I manually edit node_modules/appwrite/package.json to remove exports field.

Closing as a duplicate of #54