π Bug Report: We should remove top level `types` field in `package.json`.
Lalit3716 opened this issue Β· comments
π Reproduction steps
- Initialize a TypeScript project with
moduleResolution: "bundler"
in yourtsconfig
. - Install
appwrite
web sdk. - 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?
- I have read the Code of Conduct
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
Yeah for the time being I manually edit node_modules/appwrite/package.json
to remove exports
field.
Closing as a duplicate of #54