Skip to content
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

Typescript 5.6.x compatibility with ObservableSet and Observable Map #3927

Closed
ymor opened this issue Sep 16, 2024 · 2 comments · Fixed by #3935
Closed

Typescript 5.6.x compatibility with ObservableSet and Observable Map #3927

ymor opened this issue Sep 16, 2024 · 2 comments · Fixed by #3935
Labels

Comments

@ymor
Copy link

ymor commented Sep 16, 2024

Intended outcome:
ObservableMap should implement Map correctly and ObservableSet should implement Set correctly

Actual outcome:

Type 'ObservableMap<unknown, unknown>' is not assignable to type 'Map<unknown, unknown>'.
  The types returned by 'entries()' are incompatible between these types.
    Type 'IterableIterator<IMapEntry<unknown, unknown>>' is missing the following properties from type 'MapIterator<[unknown, unknown]>': map, filter, take, drop, and 9 more.
Type 'ObservableSet<unknown>' is not assignable to type 'Set<unknown>'.
  The types returned by 'entries()' are incompatible between these types.
    Type 'IterableIterator<[unknown, unknown]>' is missing the following properties from type 'SetIterator<[unknown, unknown]>': map, filter, take, drop, and 9 more.

How to reproduce the issue:
https://www.typescriptlang.org/play/?target=99&ts=5.6.2#code/JYWwDg9gTgLgBAbzgeQEYGcCmUBuBDVAG0wFk8wAaFDbfIzAZU3gF84AzKCEOAchAioAHrwDcAKHEBjCADt08AcLJgAXHBUAeAK6yA1rIgB3WVV0HjsgHxwAvHFmYj1LLgLEVACgCUE6XIU4JSEmGHVQnX1DExt7R2c0VzpiUJ8JIA

Seems this might be relevant https://devblogs.microsoft.com/typescript/announcing-typescript-5-6/#iterator-helper-methods

No errors in Typescript 5.5.x

Versions
mobx@6.13.2

@ymor ymor added the 🐛 bug label Sep 16, 2024
@Weffe
Copy link

Weffe commented Sep 17, 2024

Just ran into this issue too. I think we need to update ObservableMap to match the new structure for .entries() with the new iterator helpers.

@tonyraoul
Copy link
Contributor

Started working on a potential fix here
keen for your feedback.

mweststrate pushed a commit that referenced this issue Oct 15, 2024
…ers (#3927) (#3935)

* Update typescript version

* Chore(map + set): Add support for esnext Iterator helpers

* add changeset

* Update lock file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants