@jbrowse/mobx-state-tree 5.10.7 → 5.11.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/dist/index.d.ts CHANGED
@@ -1435,6 +1435,13 @@ declare function splitJsonPath(path: string): string[];
1435
1435
  * A generic disposer.
1436
1436
  */
1437
1437
  type IDisposer = () => void;
1438
+ /**
1439
+ * Forces full run-time type-checking on or off, overriding the dev-mode and
1440
+ * `ENABLE_TYPE_CHECK` env-var defaults. Pass `true` to get better error messages
1441
+ * in production builds without relying on an environment variable, `false` to
1442
+ * force it off, or `undefined` to restore the default behavior.
1443
+ */
1444
+ declare function setTypeChecking(enabled: boolean | undefined): void;
1438
1445
  /**
1439
1446
  * @internal
1440
1447
  * @hidden
@@ -1914,6 +1921,17 @@ declare function optional<IT extends IAnyType, OptionalVals extends ValidOptiona
1914
1921
  * @returns
1915
1922
  */
1916
1923
  declare function isOptionalType<IT extends IAnyType>(type: IT): type is IT;
1924
+ /**
1925
+ * `types.stripDefault` - Like `types.optional`, but the property is omitted from
1926
+ * a parent model's snapshot entirely when its value equals the default (instead
1927
+ * of being serialized with the default value). Lets a model produce minimal
1928
+ * snapshots without a bespoke `postProcessSnapshot`.
1929
+ *
1930
+ * @param type
1931
+ * @param defaultValueOrFunction
1932
+ * @returns
1933
+ */
1934
+ declare function stripDefault<IT extends IAnyType>(type: IT, defaultValueOrFunction: OptionalDefaultValueOrFunction<IT>): IOptionalIType<IT, [undefined]>;
1917
1935
 
1918
1936
  /** @hidden */
1919
1937
  interface IMaybeIType<IT extends IAnyType, C, O> extends IType<IT["CreationType"] | C, IT["SnapshotType"] | O, IT["TypeWithoutSTN"] | O> {
@@ -2142,6 +2160,7 @@ declare const types: {
2142
2160
  safeReference: typeof safeReference;
2143
2161
  union: typeof union;
2144
2162
  optional: typeof optional;
2163
+ stripDefault: typeof stripDefault;
2145
2164
  literal: typeof literal;
2146
2165
  maybe: typeof maybe;
2147
2166
  maybeNull: typeof maybeNull;
@@ -2166,5 +2185,5 @@ declare const types: {
2166
2185
  resilient: typeof resilient;
2167
2186
  };
2168
2187
 
2169
- export { addDisposer, addMiddleware, applyAction, applyPatch, applySnapshot, cast, castFlowReturn, castToReferenceSnapshot, castToSnapshot, clone, createActionTrackingMiddleware, createActionTrackingMiddleware2, decorate, destroy, detach, escapeJsonPath, flow, getChildType, getEnv, getIdentifier, getLivelinessChecking, getMembers, getNodeId, getParent, getParentOfType, getPath, getPathParts, getPropertyMembers, getRelativePath, getRoot, getRunningActionContext, getSnapshot, getType, getUnionSubtypes, hasParent, hasParentOfType, isActionContextChildOf, isActionContextThisOrChildOf, isAlive, isArrayType, isFrozenType, isIdentifierType, isLateType, isLiteralType, isMapType, isModelType, isOptionalType, isPrimitiveType, isProtected, isReferenceType, isRefinementType, isRoot, isStateTreeNode, isType, isUnionType, isValidReference, joinJsonPath, onAction, onPatch, onSnapshot, process, protect, recordActions, recordPatches, resolveIdentifier, resolvePath, setDevMode, setLivelinessChecking, setLivelynessChecking, splitJsonPath, types as t, toGenerator, toGeneratorFunction, tryReference, tryResolve, typecheck, types, unescapeJsonPath, unprotect, walk };
2188
+ export { addDisposer, addMiddleware, applyAction, applyPatch, applySnapshot, cast, castFlowReturn, castToReferenceSnapshot, castToSnapshot, clone, createActionTrackingMiddleware, createActionTrackingMiddleware2, decorate, destroy, detach, escapeJsonPath, flow, getChildType, getEnv, getIdentifier, getLivelinessChecking, getMembers, getNodeId, getParent, getParentOfType, getPath, getPathParts, getPropertyMembers, getRelativePath, getRoot, getRunningActionContext, getSnapshot, getType, getUnionSubtypes, hasParent, hasParentOfType, isActionContextChildOf, isActionContextThisOrChildOf, isAlive, isArrayType, isFrozenType, isIdentifierType, isLateType, isLiteralType, isMapType, isModelType, isOptionalType, isPrimitiveType, isProtected, isReferenceType, isRefinementType, isRoot, isStateTreeNode, isType, isUnionType, isValidReference, joinJsonPath, onAction, onPatch, onSnapshot, process, protect, recordActions, recordPatches, resolveIdentifier, resolvePath, setDevMode, setLivelinessChecking, setLivelynessChecking, setTypeChecking, splitJsonPath, types as t, toGenerator, toGeneratorFunction, tryReference, tryResolve, typecheck, types, unescapeJsonPath, unprotect, walk };
2170
2189
  export type { $EmptyObjectBrand, CustomTypeOptions, IActionContext, IActionRecorder, IActionTrackingMiddleware2Call, IActionTrackingMiddleware2Hooks, IActionTrackingMiddlewareHooks, IAnyComplexType, IAnyModelType, IAnyStateTreeNode, IAnyType, IArrayType, IComplexType, IDisposer, IJsonPatch, IMSTArray, IMSTMap, IMapType, IMaybe, IMaybeIType, IMaybeNull, IMiddlewareEvent, IMiddlewareEventType, IMiddlewareHandler, IModelReflectionData, IModelReflectionPropertiesData, IModelType, IOptionalIType, IPatchRecorder, IReferenceType, IReversibleJsonPatch, ISerializedActionCall, ISimpleType, ISnapshotProcessor, ISnapshotProcessors, IStateTreeNode, IType, ITypeUnion, Instance, LivelinessMode, LivelynessMode, ModelActions, ModelCreationType, ModelCreationType2, ModelInstanceType, ModelInstanceTypeProps, ModelPrimitive, ModelProperties, ModelPropertiesDeclaration, ModelPropertiesDeclarationToProperties, ModelSnapshotType, ModelSnapshotType2, OnReferenceInvalidated, OnReferenceInvalidatedEvent, OptionalDefaultValueOrFunction, ReferenceIdentifier, ReferenceOptions, ReferenceOptionsGetSet, ReferenceOptionsOnInvalidated, SnapshotIn, SnapshotOrInstance, SnapshotOut, TypeOfValue, TypeOrStateTreeNodeToStateTreeNode, UnionOptions, UnionStringArray, ValidOptionalValue, ValidOptionalValues, _CustomCSProcessor, _CustomJoin, _CustomOrOther, _NotCustomized };