diff --git a/flow-typed/mobx.js b/flow-typed/mobx.js index 15b3269b4..67cd3ee3a 100644 --- a/flow-typed/mobx.js +++ b/flow-typed/mobx.js @@ -233,14 +233,32 @@ export interface IObservableFactory { (value: T): T } +export type IObservableDecorator = { + (target: Object, property: string, descriptor?: PropertyDescriptor): void, + enhancer: IEnhancer +} + +export type CreateObservableOptions = { + name?: string, + deep?: boolean, + defaultDecorator?: IObservableDecorator +} + declare export class IObservableFactories { - box(value?: T, name?: string): IObservableValue, - array(initialValues?: T[], name?: string): IObservableArray, - map(initialValues?: IObservableMapInitialValues, name?: string): ObservableMap, - object(props: T, name?: string): T & IObservableObject, - ref(target: Object, property?: string, descriptor?: PropertyDescriptor): any, - shallow(target: Object, property?: string, descriptor?: PropertyDescriptor): any, - deep(target: Object, property?: string, descriptor?: PropertyDescriptor): any + box(value?: T, options?: CreateObservableOptions): IObservableValue, + array(initialValues?: T[], options?: CreateObservableOptions): IObservableArray, + map( + initialValues?: IObservableMapInitialValues, + options?: CreateObservableOptions + ): ObservableMap, + object(props: T, options?: CreateObservableOptions): T & IObservableObject, + ref(target: Object, property?: string, descriptor?: PropertyDescriptor): IObservableDecorator, + shallow( + target: Object, + property?: string, + descriptor?: PropertyDescriptor + ): IObservableDecorator, + deep(target: Object, property?: string, descriptor?: PropertyDescriptor): IObservableDecorator } export interface Iterator {