Why is IValueDidChange
using unknown-property values?
#3517
-
The current type-interface for type IValueDidChange<T = any> = {
type: "update";
observableKind: "value";
object: IObservableValue<T>;
debugObjectName: string;
newValue: unknown;
oldValue: unknown;
} In an older version of mobx, this was typed so that |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
This change also impacts us in a large codebase. It seems like this was done out of concern that a value could escape the type system, but I don't see how that is possible given
It would be helpful if the maintainers can advise what risk was mitigated by this change. This information will help steer our implementation of additional runtime type checking to resolve the new type errors. |
Beta Was this translation helpful? Give feedback.
-
The |
Beta Was this translation helpful? Give feedback.
The
unknown
looks really strange indeed, and I can't find any history back that this was intentionally changed, so feel to change it back. I'm wondering if this is strictness implemented wrong, and that the actual thing that should have happened is changing the generic default fromT = any
toT = unknown
. Feel free to submit a PR.