Skip to content

Conversation

@septs
Copy link
Contributor

@septs septs commented Jun 11, 2025

type defintion:

export type CompactTLV = CompactTLV.Entries

export namespace CompactTLV {
  export type Entries = readonly CompactTLV.Entry[]

  export type Entry = readonly [tag: number, value: Uint8Array]
}

converation code:

Map(entries)

error message:

Argument of type 'Entries' is not assignable to parameter of type 'Iterable<[number, Uint8Array<ArrayBufferLike>]>'.
  The types returned by '[Symbol.iterator]().next(...)' are incompatible between these types.
    Type 'IteratorResult<Entry, undefined>' is not assignable to type 'IteratorResult<[number, Uint8Array<ArrayBufferLike>], any>'.
      Type 'IteratorYieldResult<Entry>' is not assignable to type 'IteratorResult<[number, Uint8Array<ArrayBufferLike>], any>'.
        Type 'IteratorYieldResult<Entry>' is not assignable to type 'IteratorYieldResult<[number, Uint8Array<ArrayBufferLike>]>'.
          The type 'Entry' is 'readonly' and cannot be assigned to the mutable type '[number, Uint8Array<ArrayBufferLike>]'.ts(2345)

@septs
Copy link
Contributor Author

septs commented Jun 11, 2025

readonly array is array subset, will not break compatibility

see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#readonly-tuples

@jdeniau
Copy link
Member

jdeniau commented Jun 11, 2025

Nice catch 👍

@jdeniau jdeniau merged commit b718c4d into immutable-js:main Jun 11, 2025
5 checks passed
@jdeniau
Copy link
Member

jdeniau commented Jun 11, 2025

This has been released in v5.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants