Skip to content
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
@rryter

Description

@rryter
  • 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
  1. Create a new file
  2. Import the Options Type
import { Options } from 'ipfs-http-client';
export interface InterfaceName {
  options: Options;
}
  1. 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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    need/author-inputNeeds input from the original author

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions