Skip to content

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

@mirceanis

Description

@mirceanis

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions