Skip to content
This repository was archived by the owner on Jan 7, 2026. It is now read-only.

chore: fix TypeScript error#616

Merged
bajtos merged 1 commit intomainfrom
fix-type-errors
Aug 6, 2025
Merged

chore: fix TypeScript error#616
bajtos merged 1 commit intomainfrom
fix-type-errors

Conversation

@bajtos
Copy link
Member

@bajtos bajtos commented Aug 6, 2025

Fix the following error:

lib/storacha.js:12:20 - error TS2345: Argument of type 'Block[]' is not assignable to parameter of type 'Iterable<Block<unknown, number, number, 1>>'.
  The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
    Type 'IteratorResult<Block, any>' is not assignable to type 'IteratorResult<Block<unknown, number, number, 1>, any>'.
      Type 'IteratorYieldResult<Block>' is not assignable to type 'IteratorResult<Block<unknown, number, number, 1>, any>'.
        Type 'IteratorYieldResult<Block>' is not assignable to type 'IteratorYieldResult<Block<unknown, number, number, 1>>'.
          Type 'Block' is not assignable to type 'Block<unknown, number, number, 1>'.
            The types of 'cid.version' are incompatible between these types.
              Type 'Version' is not assignable to type '1'.
                Type '0' is not assignable to type '1'.

12   return importDAG(blocks)

```
lib/storacha.js:12:20 - error TS2345: Argument of type 'Block[]' is not assignable to parameter of type 'Iterable<Block<unknown, number, number, 1>>'.
  The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
    Type 'IteratorResult<Block, any>' is not assignable to type 'IteratorResult<Block<unknown, number, number, 1>, any>'.
      Type 'IteratorYieldResult<Block>' is not assignable to type 'IteratorResult<Block<unknown, number, number, 1>, any>'.
        Type 'IteratorYieldResult<Block>' is not assignable to type 'IteratorYieldResult<Block<unknown, number, number, 1>>'.
          Type 'Block' is not assignable to type 'Block<unknown, number, number, 1>'.
            The types of 'cid.version' are incompatible between these types.
              Type 'Version' is not assignable to type '1'.
                Type '0' is not assignable to type '1'.

12   return importDAG(blocks)
```

Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
Comment on lines +6 to +13
/**
* @param {string} data
*/
async function parseProof (data) {
// Casting to unsafe `any[]` to avoid the following TypeScript error:
// Argument of type 'Block[]' is not assignable to parameter
// of type 'Iterable<Block<unknown, number, number, 1>>'
/** @type {any[]} */
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bajtos bajtos merged commit 4bf1228 into main Aug 6, 2025
6 checks passed
@bajtos bajtos deleted the fix-type-errors branch August 6, 2025 10:25
@github-project-automation github-project-automation bot moved this to ✅ done in CheckerNetwork Aug 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Status: ✅ done

Development

Successfully merging this pull request may close these issues.

2 participants