mobx 6.12.5 → 6.13.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.
@@ -42,6 +42,13 @@ export declare class ObservableSet<T = any> implements Set<T>, IInterceptable<IS
42
42
  entries(): IterableIterator<[T, T]>;
43
43
  keys(): IterableIterator<T>;
44
44
  values(): IterableIterator<T>;
45
+ intersection<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T & U>;
46
+ union<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T | U>;
47
+ difference<U>(otherSet: ReadonlySetLike<U>): Set<T>;
48
+ symmetricDifference<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T | U>;
49
+ isSubsetOf(otherSet: ReadonlySetLike<unknown>): boolean;
50
+ isSupersetOf(otherSet: ReadonlySetLike<unknown>): boolean;
51
+ isDisjointFrom(otherSet: ReadonlySetLike<unknown> | Set<unknown>): boolean;
45
52
  replace(other: ObservableSet<T> | IObservableSetInitialValues<T>): ObservableSet<T>;
46
53
  observe_(listener: (changes: ISetDidChange<T>) => void, fireImmediately?: boolean): Lambda;
47
54
  intercept_(handler: IInterceptor<ISetWillChange<T>>): Lambda;
@@ -1,7 +1,7 @@
1
1
  export declare const assign: {
2
2
  <T extends {}, U>(target: T, source: U): T & U;
3
- <T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
4
- <T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
3
+ <T extends {}, U, V>(target: T, source1: U, source2: V): T & U & V;
4
+ <T extends {}, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W;
5
5
  (target: object, ...sources: any[]): any;
6
6
  };
7
7
  export declare const getDescriptor: (o: any, p: PropertyKey) => PropertyDescriptor | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobx",
3
- "version": "6.12.5",
3
+ "version": "6.13.0",
4
4
  "description": "Simple, scalable state management.",
5
5
  "source": "src/mobx.ts",
6
6
  "main": "dist/index.js",
@@ -243,6 +243,54 @@ export class ObservableSet<T = any> implements Set<T>, IInterceptable<ISetWillCh
243
243
  } as any)
244
244
  }
245
245
 
246
+ intersection<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T & U> {
247
+ if (isES6Set(otherSet)) {
248
+ return otherSet.intersection(this)
249
+ } else {
250
+ const dehancedSet = new Set(this)
251
+ return dehancedSet.intersection(otherSet)
252
+ }
253
+ }
254
+
255
+ union<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T | U> {
256
+ if (isES6Set(otherSet)) {
257
+ return otherSet.union(this)
258
+ } else {
259
+ const dehancedSet = new Set(this)
260
+ return dehancedSet.union(otherSet)
261
+ }
262
+ }
263
+
264
+ difference<U>(otherSet: ReadonlySetLike<U>): Set<T> {
265
+ return new Set(this).difference(otherSet)
266
+ }
267
+
268
+ symmetricDifference<U>(otherSet: ReadonlySetLike<U> | Set<U>): Set<T | U> {
269
+ if (isES6Set(otherSet)) {
270
+ return otherSet.symmetricDifference(this)
271
+ } else {
272
+ const dehancedSet = new Set(this)
273
+ return dehancedSet.symmetricDifference(otherSet)
274
+ }
275
+ }
276
+
277
+ isSubsetOf(otherSet: ReadonlySetLike<unknown>): boolean {
278
+ return new Set(this).isSubsetOf(otherSet)
279
+ }
280
+
281
+ isSupersetOf(otherSet: ReadonlySetLike<unknown>): boolean {
282
+ return new Set(this).isSupersetOf(otherSet)
283
+ }
284
+
285
+ isDisjointFrom(otherSet: ReadonlySetLike<unknown> | Set<unknown>): boolean {
286
+ if (isES6Set(otherSet)) {
287
+ return otherSet.isDisjointFrom(this)
288
+ } else {
289
+ const dehancedSet = new Set(this)
290
+ return dehancedSet.isDisjointFrom(otherSet)
291
+ }
292
+ }
293
+
246
294
  replace(other: ObservableSet<T> | IObservableSetInitialValues<T>): ObservableSet<T> {
247
295
  if (isObservableSet(other)) {
248
296
  other = new Set(other)