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

typescript error TS2307: Cannot find module './util/bases' or its corresponding type declarations. #23

Closed
mirceanis opened this issue Jul 27, 2021 · 0 comments · Fixed by #24

Comments

@mirceanis
Copy link
Contributor

mirceanis commented Jul 27, 2021

I get the error in the title when I try to use this library in a typescript project with the following settings in tsconfig.json

{
  "strict": true,
  "skipLibCheck": false
}

Here is a minimal project that reproduces the issue when you run npm install

It seems to be caused by a mismatch in layout between the source tree and the dist file tree.
In dist/to-string.d.ts, the .util/bases path is no longer valid, it should be ../util.bases

Perhaps this is an aegir bug ( ipfs/aegir#759 ipfs/aegir#849 ), but I think it can also be worked around if the source files are moved to a src/ folder instead of the root dir. That should keep the path consistent in both source and dist situations.

Edit:
It seems the files are placed correctly by aegir but are excluded from packing by the very strict files entry in package.json.

Edit:
This bug has been introduced in 99c8aaa so it affects versions 2.1.6 & 2.1.7

mirceanis added a commit to mirceanis/uint8arrays that referenced this issue Jul 27, 2021
achingbrain pushed a commit that referenced this issue Jul 27, 2021
Otherwise ts cannot find the typedefs for files in the utils folder.

Fixes #23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant