mobx 6.5.0 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobx",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "Simple, scalable state management.",
5
5
  "source": "src/mobx.ts",
6
6
  "main": "dist/index.js",
@@ -136,6 +136,11 @@ function createObservable(v: any, arg2?: any, arg3?: any) {
136
136
  }
137
137
  Object.assign(createObservable, observableDecoratorAnnotation)
138
138
 
139
+ export interface IObservableValueFactory {
140
+ <T>(value: T, options?: CreateObservableOptions): IObservableValue<T>
141
+ <T>(value?: T, options?: CreateObservableOptions): IObservableValue<T | undefined>
142
+ }
143
+
139
144
  export interface IObservableFactory extends Annotation, PropertyDecorator {
140
145
  <T = any>(value: T[], options?: CreateObservableOptions): IObservableArray<T>
141
146
  <T = any>(value: Set<T>, options?: CreateObservableOptions): ObservableSet<T>
@@ -146,7 +151,7 @@ export interface IObservableFactory extends Annotation, PropertyDecorator {
146
151
  options?: CreateObservableOptions
147
152
  ): T
148
153
 
149
- box: <T = any>(value?: T, options?: CreateObservableOptions) => IObservableValue<T>
154
+ box: IObservableValueFactory
150
155
  array: <T = any>(initialValues?: T[], options?: CreateObservableOptions) => IObservableArray<T>
151
156
  set: <T = any>(
152
157
  initialValues?: IObservableSetInitialValues<T>,
@@ -175,7 +180,7 @@ export interface IObservableFactory extends Annotation, PropertyDecorator {
175
180
  }
176
181
 
177
182
  const observableFactories: IObservableFactory = {
178
- box<T = any>(value?: T, options?: CreateObservableOptions): IObservableValue<T> {
183
+ box<T = any>(value: T, options?: CreateObservableOptions): IObservableValue<T> {
179
184
  const o = asCreateObservableOptions(options)
180
185
  return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals)
181
186
  },
package/src/mobx.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * (c) Michel Weststrate 2015 - 2020
3
3
  * MIT Licensed
4
4
  *
5
- * Welcome to the mobx sources! To get an global overview of how MobX internally works,
5
+ * Welcome to the mobx sources! To get a global overview of how MobX internally works,
6
6
  * this is a good place to start:
7
7
  * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74
8
8
  *