mobx-state-tree 7.1.0 → 7.2.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.
@@ -1,10 +1,10 @@
1
- import { ISimpleType } from "../../internal";
1
+ import { ISimpleType, IType } from "../../internal";
2
2
  /**
3
3
  * `types.identifier` - Identifiers are used to make references, lifecycle events and reconciling works.
4
4
  * Inside a state tree, for each type can exist only one instance for each given identifier.
5
5
  * For example there couldn't be 2 instances of user with id 1. If you need more, consider using references.
6
6
  * Identifier can be used only as type property of a model.
7
- * This type accepts as parameter the value type of the identifier field that can be either string or number.
7
+ * This type accepts as parameter the value type of the identifier field that can be either string, number or bigint.
8
8
  *
9
9
  * Example:
10
10
  * ```ts
@@ -31,14 +31,28 @@ export declare const identifier: ISimpleType<string>;
31
31
  * @returns
32
32
  */
33
33
  export declare const identifierNumber: ISimpleType<number>;
34
+ /**
35
+ * `types.identifierBigint` - Similar to `types.identifier`. Snapshots serialize to string (JSON-safe) and deserialize from string, number or bigint.
36
+ *
37
+ * Example:
38
+ * ```ts
39
+ * const Todo = types.model("Todo", {
40
+ * id: types.identifierBigint,
41
+ * title: types.string
42
+ * })
43
+ * ```
44
+ *
45
+ * @returns
46
+ */
47
+ export declare const identifierBigint: IType<bigint | string | number, string, bigint>;
34
48
  /**
35
49
  * Returns if a given value represents an identifier type.
36
50
  *
37
51
  * @param type
38
52
  * @returns
39
53
  */
40
- export declare function isIdentifierType(type: unknown): type is typeof identifier | typeof identifierNumber;
54
+ export declare function isIdentifierType(type: unknown): type is typeof identifier | typeof identifierNumber | typeof identifierBigint;
41
55
  /**
42
56
  * Valid types for identifiers.
43
57
  */
44
- export type ReferenceIdentifier = string | number;
58
+ export type ReferenceIdentifier = string | number | bigint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobx-state-tree",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "description": "Opinionated, transactional, MobX powered state container",
5
5
  "main": "dist/mobx-state-tree.js",
6
6
  "umd:main": "dist/mobx-state-tree.umd.js",