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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: We should remove top level types field in package.json. #55

Closed
2 tasks done
Lalit3716 opened this issue May 20, 2023 · 4 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@Lalit3716
Copy link

👟 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?

@Lalit3716 Lalit3716 added the bug Something isn't working label May 20, 2023
@Lalit3716
Copy link
Author

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.

@justin-prather
Copy link

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

@Lalit3716
Copy link
Author

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

@stnguyen90
Copy link
Contributor

Closing as a duplicate of #54

@stnguyen90 stnguyen90 closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2023
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

3 participants