Skip to content

Commit

Permalink
Add IObservableDecorator to Flow type
Browse files Browse the repository at this point in the history
  • Loading branch information
quanganhtran committed Apr 15, 2018
1 parent 6f0bb9b commit dbef2ab
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions flow-typed/mobx.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
// @flow

export type CreateObservableOptions = {
name?: string,
deep?: boolean,
defaultDecorator?: any
}

export type IObservableMapInitialValues<K, V> = IMapEntries<K, V> | KeyValueMap<V> | IMap<K, V>

export interface IMobxConfigurationOptions {
Expand Down Expand Up @@ -239,6 +233,17 @@ export interface IObservableFactory {
<T: Object>(value: T): T
}

export type IObservableDecorator = {
(target: Object, property: string, descriptor?: PropertyDescriptor): void,
enhancer: IEnhancer<any>
}

export type CreateObservableOptions = {
name?: string,
deep?: boolean,
defaultDecorator?: IObservableDecorator
}

declare export class IObservableFactories {
box<T>(value?: T, options?: CreateObservableOptions): IObservableValue<T>,
array<T>(initialValues?: T[], options?: CreateObservableOptions): IObservableArray<T>,
Expand All @@ -247,9 +252,13 @@ declare export class IObservableFactories {
options?: CreateObservableOptions
): ObservableMap<K, V>,
object<T>(props: T, options?: CreateObservableOptions): 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
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<T> {
Expand Down

0 comments on commit dbef2ab

Please sign in to comment.