You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Presently, calling mobx.observable({}) returns a T, and there's no way for my downstream code to assert that it's passed an observable object. Knowing when an object is observable is desirable for e.g., guaranteeing my React components receive objects that will actually mutate my UI when I change them.
My PR uses TypeScript 1.4's union types to change the return type of mobx.observable() to T & IObservable. This should be fully backwards-compatible, since TypeScript will still treat the object as type T. But now consumers have the option of enforcing that various pieces of their apps receive observable objects by demanding a mobx.IObservable.
The text was updated successfully, but these errors were encountered:
Presently, calling
mobx.observable({})
returns aT
, and there's no way for my downstream code to assert that it's passed an observable object. Knowing when an object is observable is desirable for e.g., guaranteeing my React components receive objects that will actually mutate my UI when I change them.My PR uses TypeScript 1.4's union types to change the return type of
mobx.observable()
toT & IObservable
. This should be fully backwards-compatible, since TypeScript will still treat the object as typeT
. But now consumers have the option of enforcing that various pieces of their apps receive observable objects by demanding amobx.IObservable
.The text was updated successfully, but these errors were encountered: