Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix: allow readonly map entry constructor #2123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 11, 2025
Merged

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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.