multiformats / js-multiformats

Multiformats interface (multihash, multicodec, multibase and CID)
Other
224 stars 52 forks source link

breaking change introduced with generic blockcodec api #300

Closed tabcat closed 1 month ago

tabcat commented 1 month ago

Multiformats 13.2 includes an unintended breaking change as a result of https://github.com/multiformats/js-multiformats/pull/294

Output of trying to build helia with multiformats 13.2:

src/commands/utils/persist.ts(16,5): error TS2322: Type 'typeof import("/home/tabcat/github.com/ipfs/helia/node_modules/@ipld/dag-pb/dist/src/index")' is not assignable to type 'BlockCodec<any, any>'.
  The types returned by 'encode(...)' are incompatible between these types.
    Type 'ByteView<PBNode>' is not assignable to type 'ByteView<T>'.
      Type 'PBNode' is not assignable to type 'T'.
        'PBNode' is assignable to the constraint of type 'T', but 'T' could be instantiated with a different subtype of constraint 'any'.
src/commands/utils/persist.ts(20,46): error TS18048: 'options.codec' is possibly 'undefined'.
src/commands/utils/remove-link.ts(170,5): error TS2322: Type 'typeof import("/home/tabcat/github.com/ipfs/helia/node_modules/@ipld/dag-pb/dist/src/index")' is not assignable to type 'BlockCodec<any, any>'
tabcat commented 1 month ago

Probably should just be reverted instead of cutting a new major version because it could be quite an involved process for users to upgrade.

tabcat commented 1 month ago

Fixed by version 13.2.1