mobx-state-tree
Advanced tools
Comparing version 5.4.0-pre.1 to 5.4.0
@@ -1,2 +0,2 @@ | ||
import { IType, IAnyType } from "../../internal"; | ||
import { IType, IAnyType, Instance } from "../../internal"; | ||
/** @hidden */ | ||
@@ -18,7 +18,7 @@ declare const $mstNotCustomized: unique symbol; | ||
*/ | ||
export interface ISnapshotProcessors<C, CustomC, S, CustomS> { | ||
export interface ISnapshotProcessors<IT extends IAnyType, CustomC, CustomS> { | ||
/** | ||
* Function that transforms an input snapshot. | ||
*/ | ||
preProcessor?(snapshot: CustomC): C; | ||
preProcessor?(snapshot: CustomC): IT["CreationType"]; | ||
/** | ||
@@ -28,3 +28,3 @@ * Function that transforms an output snapshot. | ||
*/ | ||
postProcessor?(snapshot: S): CustomS; | ||
postProcessor?(snapshot: IT["SnapshotType"], node: Instance<IT>): CustomS; | ||
} | ||
@@ -41,5 +41,6 @@ /** | ||
* } | ||
* | ||
* const Todo2 = types.snapshotProcessor(Todo1, { | ||
* // from snapshot to instance | ||
* preProcessor(sn: BackendTodo) { | ||
* preProcessor(snapshot: BackendTodo) { | ||
* return { | ||
@@ -49,4 +50,5 @@ * text: sn.text || ""; | ||
* }, | ||
* | ||
* // from instance to snapshot | ||
* postProcessor(sn): BackendTodo { | ||
* postProcessor(snapshot, node): BackendTodo { | ||
* return { | ||
@@ -64,3 +66,3 @@ * text: !sn.text ? null : sn.text | ||
*/ | ||
export declare function snapshotProcessor<IT extends IAnyType, CustomC = _NotCustomized, CustomS = _NotCustomized>(type: IT, processors: ISnapshotProcessors<IT["CreationType"], CustomC, IT["SnapshotType"], CustomS>, name?: string): ISnapshotProcessor<IT, CustomC, CustomS>; | ||
export declare function snapshotProcessor<IT extends IAnyType, CustomC = _NotCustomized, CustomS = _NotCustomized>(type: IT, processors: ISnapshotProcessors<IT, CustomC, CustomS>, name?: string): ISnapshotProcessor<IT, CustomC, CustomS>; | ||
export {}; |
{ | ||
"name": "mobx-state-tree", | ||
"version": "5.4.0-pre.1", | ||
"version": "5.4.0", | ||
"description": "Opinionated, transactional, MobX powered state container", | ||
@@ -20,3 +20,2 @@ "main": "dist/mobx-state-tree.js", | ||
"build": "yarn clean && tsc && cpr lib dist --filter=\\.js$ && rollup -c", | ||
"jest": "jest --testPathPattern=/__tests__/core/", | ||
"jest:perf": "jest --testPathPattern=/__tests__/perf/", | ||
@@ -23,0 +22,0 @@ "test:perf": "yarn build && yarn jest:perf && TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' /usr/bin/time node --expose-gc --require ts-node/register __tests__/perf/report.ts", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1284421
28503
3