Skip to content

Commit

Permalink
Merge pull request #1501 from quanganhtran/master
Browse files Browse the repository at this point in the history
Fix Flow typing for observable.map
  • Loading branch information
mweststrate authored Apr 16, 2018
2 parents 7179b96 + dbef2ab commit 09493ee
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions flow-typed/mobx.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,32 @@ 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, name?: string): IObservableValue<T>,
array<T>(initialValues?: T[], name?: string): IObservableArray<T>,
map<T>(initialValues?: IObservableMapInitialValues<T>, name?: string): ObservableMap<T>,
object<T>(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<T>(value?: T, options?: CreateObservableOptions): IObservableValue<T>,
array<T>(initialValues?: T[], options?: CreateObservableOptions): IObservableArray<T>,
map<K, V>(
initialValues?: IObservableMapInitialValues<K, V>,
options?: CreateObservableOptions
): ObservableMap<K, V>,
object<T>(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<T> {
Expand Down

0 comments on commit 09493ee

Please sign in to comment.