-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Cannot extend Map #1858
Comments
I test your code and it works fine. My TS version is 3.2.2. update: I was wrong. I only checked if TS is working fine. However, it goes fine because |
Sounds strange because test function is written like |
By default ES6 maps will be converted into observable maps. If you want to
skip that behavior, use `@observable.ref` instead of `@observable`, and the
map itself will not be turned into an observable
Op do 3 jan. 2019 om 13:22 schreef philipp-sorin <[email protected]>:
… Sounds starag because if test function is written like value instanceof
Map which is satisfy my case
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1858 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhHLeUNY_YBjnLh-V3YhT83hSMlZ5ks5u_fYRgaJpZM4ZnYsb>
.
|
@mweststrate Because now, instead of extending Map and creating own observable using Atom, I have to write composite for Map. And this leads to the loss of some features, such as |
Agreed, PR welcome :) I don't think we had a case before where someone used
a subclass of a Map
Op do 3 jan. 2019 om 14:12 schreef philipp-sorin <[email protected]>:
… @mweststrate <https://github.com/mweststrate>
But it's not a direct Map, it's a sub type of the Map.
It should rather throw an Error if it cannot be converted, but silently
change subtype to another subtype of base class looks like not good idea.
Because now, instead of extending Map and creating own observable using
Atom, I have to write composite for Map. And this leads to the loss of some
features, such as instanceof
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1858 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhLY3OTLD14oHhJS-ohkGAHMVqZvTks5u_gG-gaJpZM4ZnYsb>
.
|
@mweststrate |
I think we can leave the issue open for now and rename it, to throw in such
cases :)
Op vr 4 jan. 2019 om 11:53 schreef philipp-sorin <[email protected]>:
… @mweststrate <https://github.com/mweststrate>
Ok, maybe check it later when I will have time, so the issue seems to be
closed by now?
Or should it be a feature request?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1858 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABvGhIS9uBnfjTZukQm1JaGrH5feJb_Tks5u_zK_gaJpZM4ZnYsb>
.
|
Subclassing Map will be forbidden in the next version, as inheritance trees will be lost during cloning. Instead, use generic utilities like: public findOne(map someMap, id: string): Optional<string> {
// code operation on map
} |
Addressed and released in 4.9.0 / 5.9.0 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions. |
Hey,
Mobx behaves incorrectly with classes extended from build-ins like Map<K, V>
For example (TS)
The text was updated successfully, but these errors were encountered: