mobx-state-tree
Advanced tools
Comparing version 7.0.0-pre.1 to 7.0.0-pre.2
import { IValidationContext, IValidationResult, IStateTreeNode, ModelPrimitive } from "../../internal"; | ||
import type { WritableKeys } from "ts-essentials"; | ||
/** | ||
@@ -9,2 +10,3 @@ * A state tree node value. | ||
declare const $type: unique symbol; | ||
type ExcludeReadonly<T> = T extends {} ? T[WritableKeys<T>] : T; | ||
/** | ||
@@ -29,3 +31,3 @@ * A type, either complex or simple. | ||
*/ | ||
create(snapshot?: C, env?: any): this["Type"]; | ||
create(snapshot?: C | ExcludeReadonly<T>, env?: any): this["Type"]; | ||
/** | ||
@@ -45,3 +47,3 @@ * Checks if a given snapshot / instance is of the given type. | ||
*/ | ||
validate(thing: C, context: IValidationContext): IValidationResult; | ||
validate(thing: C | T, context: IValidationContext): IValidationResult; | ||
/** | ||
@@ -48,0 +50,0 @@ * Gets the textual representation of the type as a string. |
@@ -44,3 +44,3 @@ import { IAnyType, IType, _CustomOrOther, _NotCustomized, Instance, FunctionWithFlag } from "../../internal"; | ||
export type ExtractCFromProps<P extends ModelProperties> = MaybeEmpty<{ | ||
[k in keyof P]: P[k]["CreationType"]; | ||
[k in keyof P]: P[k]["CreationType"] | P[k]["TypeWithoutSTN"]; | ||
}>; | ||
@@ -47,0 +47,0 @@ /** @hidden */ |
@@ -22,3 +22,3 @@ import { IType, IAnyType, Instance } from "../../internal"; | ||
*/ | ||
preProcessor?(snapshot: CustomC): IT["CreationType"]; | ||
preProcessor?(snapshot: _CustomOrOther<CustomC, IT["CreationType"]>): IT["CreationType"]; | ||
/** | ||
@@ -28,3 +28,3 @@ * Function that transforms an output snapshot. | ||
*/ | ||
postProcessor?(snapshot: IT["SnapshotType"], node: Instance<IT>): CustomS; | ||
postProcessor?(snapshot: IT["SnapshotType"], node: Instance<IT>): _CustomOrOther<CustomS, IT["SnapshotType"]>; | ||
} | ||
@@ -31,0 +31,0 @@ /** |
{ | ||
"name": "mobx-state-tree", | ||
"version": "7.0.0-pre.1", | ||
"version": "7.0.0-pre.2", | ||
"description": "Opinionated, transactional, MobX powered state container", | ||
@@ -18,4 +18,4 @@ "main": "dist/mobx-state-tree.js", | ||
"scripts": { | ||
"clean": "shx rm -rf dist && shx rm -rf lib", | ||
"build": "bun run clean && tsc && cpr lib dist --filter=\\.js$ && rollup -c", | ||
"clean": "shx rm -rf dist lib", | ||
"build": "bun run clean && tsc && cpr lib/src dist --filter=\\.js$ && rollup -c", | ||
"test:dev": "./scripts/bun-test-dev.sh", | ||
@@ -22,0 +22,0 @@ "test:prod": "./scripts/bun-test-prod.sh", |
1281496
28639