Generated ambeint typescript modules contain import paths incompatible with esmodule

The affected branch of my project: GitHub - solipsis-project/mizu-client at dev

I’m working on a Node project build on IPFS. However, whenever I attempt to build my project I get multiple similar errors from the different IPFS packages I depend on. This is one of them:

node_modules/ipfs-bitswap/dist/src/wantlist/entry.d.ts:11:22 - error TS2307: Cannot find module '../message/message' or its corresponding type declarations.

11     wantType: import("../message/message").Message.Wantlist.WantType;

The files with the problem are type declaration files generated by aegir.

My understanding is that CommonJS modules don’t require file extensions for their imports, but ESModules do. Thus, my interpretation of the problem is that aegir is generating these based on the assumption that they will be used in a CommonJS module, despite the fact that both the ipfs packages and my package are ESModules (they both declare "type": "module" in their package.json)

This may just be an issue with my config: I admit I don’t fully understand the intricacies of module resolution. My tsconfig (also available from the link above) is this:

{
  "compilerOptions": {
    "module": "esnext",
    "esModuleInterop": true,
    "target": "es6",
    "moduleResolution": "node",
    "sourceMap": true,
    "outDir": "dist",
    "typeRoots": [
      "./node_modules/sparqljs-legacy-type/",
      "./node_modules/@types",
    ]
  },
  "exclude": [
    "./tests/"
  ],
  "lib": [
    "es2015"
  ]
}

Is there a configuration issue that would cause this behavior? How can I correctly build my package while depending on IPFS’s libraries?