Extend Atom's update interface
Summary: This help handle updates to objects containing JSONObject type (generates typescript errors around infinite recursion: > Type instantiation is excessively deep and possibly infinite.ts(2589) Reviewed By: mweststrate Differential Revision: D28098502 fbshipit-source-id: a8e7f785b03bce7c8e1c0b355e2eca2e087b1881
This commit is contained in:
committed by
Facebook GitHub Bot
parent
84b48ff7e9
commit
8a3ba8615d
@@ -22,6 +22,7 @@ export interface ReadOnlyAtom<T> {
|
||||
export interface Atom<T> extends ReadOnlyAtom<T> {
|
||||
set(newValue: T): void;
|
||||
update(recipe: (draft: Draft<T>) => void): void;
|
||||
update<X extends T>(recipe: (draft: X) => void): void;
|
||||
}
|
||||
|
||||
class AtomValue<T> implements Atom<T>, Persistable {
|
||||
|
||||
Reference in New Issue
Block a user