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

Commit ed6c33e

Browse files
committed
chore: fix TypeScript 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) ```kk Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
1 parent 328b5a3 commit ed6c33e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/storacha.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ import { ed25519 } from '@ucanto/principal'
33
import { CarReader } from '@ipld/car'
44
import { importDAG } from '@ucanto/core/delegation'
55

6+
/**
7+
* @param {string} data
8+
*/
69
async function parseProof (data) {
10+
// Casting to unsafe `any[]` to avoid the following TypeScript error:
11+
// Argument of type 'Block[]' is not assignable to parameter
12+
// of type 'Iterable<Block<unknown, number, number, 1>>'
13+
/** @type {any[]} */
714
const blocks = []
815
const reader = await CarReader.fromBytes(Buffer.from(data, 'base64'))
916
for await (const block of reader.blocks()) {

0 commit comments

Comments
 (0)