This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
[ipfs-http-client@52.0.2] Typescript compilation fails when package is imported #3839
Closed
Description
-
Version:
"ipfs-http-client": "52.0.2",
-
Platform:
Ubuntu 20.04 -
Subsystem:
Typescript 4.3.5
Severity:
Critical - Comilation fails as soon as the package is imported.
Description:
node_modules/ipfs-utils/dist/src/files/glob-source.d.ts:10:20
error TS2307: Cannot find module 'ipfs-unixfs/dist/src/types' or its corresponding type declarations.
10 mtime?: import("ipfs-unixfs/dist/src/types").MtimeLike | undefined;
So I checked the package in the node_modules
, and there is indeed no dist
folder.
Steps to reproduce the error:
npx typescript-starter
npm i ipfs-http-client
- Create a new file
- Import the Options Type
import { Options } from 'ipfs-http-client';
export interface InterfaceName {
options: Options;
}
- Try to compile.
Workaround
Add postinstall
to the scripts in your npm package:
"postinstall": "npm run generate-types && cd node_modules/ipfs-unixfs && npm i --production"