@jbrowse/mobx-state-tree 6.5.1 → 6.6.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/CHANGELOG.md CHANGED
@@ -1,3 +1,73 @@
1
+ ## [6.6.0](https://github.com/GMOD/mobx-state-tree/compare/v6.5.2...v6.6.0) (2026-09-24)
2
+
3
+ ### Bug Fixes
4
+
5
+ - Stop overwriting the wrapped type's create ([f8a73dc](https://github.com/GMOD/mobx-state-tree/commit/f8a73dc2f1963828ac51d8bf7ef3ee18d2bb416a))
6
+ - Invalidate references whose target leaves with an ancestor ([fb1a8ee](https://github.com/GMOD/mobx-state-tree/commit/fb1a8ee3d2b73e4793737b8061ad2fa1ddf088aa))
7
+
8
+ ### Documentation
9
+
10
+ - ADRs for the guard and processor-typing decisions; refresh CLAUDE.md ([a6a1776](https://github.com/GMOD/mobx-state-tree/commit/a6a17769cf715b8a2a8807e110ceedcda34680af))
11
+
12
+ ### Refactoring
13
+
14
+ - Chain snapshot processors only where there are two ([133a750](https://github.com/GMOD/mobx-state-tree/commit/133a75096a5a266ac31cfd75730e9cd35fdae135))
15
+ - Dedupe the node lifecycle and drop dead weight ([0f3f682](https://github.com/GMOD/mobx-state-tree/commit/0f3f68216b84d2080793f8b141ea4033d2c6f528))
16
+
17
+ ### Types
18
+
19
+ - Infer enumeration members, export what public signatures name ([ba784a6](https://github.com/GMOD/mobx-state-tree/commit/ba784a6bbc750bc3e361273330d0be054264202e))
20
+ - Variadic signatures in place of the generated overloads ([c8d062d](https://github.com/GMOD/mobx-state-tree/commit/c8d062d14fadc99c93dfd2c05fb2dd444f813227))
21
+ - Snapshot processors pass through keys they do not own ([bc6c747](https://github.com/GMOD/mobx-state-tree/commit/bc6c7479f5b362c94db5d81de00afaad88c87d56))
22
+ - IsArrayType/isMapType/isModelType stop narrowing unsoundly ([540e9f7](https://github.com/GMOD/mobx-state-tree/commit/540e9f74a5878d8c817dbc3521c42ef6a984ab0b))
23
+
24
+ ## [6.5.2](https://github.com/GMOD/mobx-state-tree/compare/v6.3.1...v6.5.2) (2026-09-19)
25
+
26
+ ### Bug Fixes
27
+
28
+ - Reconcile through the loaded type instead of recreating the node ([3741894](https://github.com/GMOD/mobx-state-tree/commit/37418940fe11bc243b77d389f8e6e95cf77d2abe))
29
+
30
+ ### Chores
31
+
32
+ - Delete the union overload generator, dead since the variadic signatures ([0591a1a](https://github.com/GMOD/mobx-state-tree/commit/0591a1a58e5cd200b0329c4c169973d434498057))
33
+ - Create a GitHub release on publish, with git-cliff changelog notes ([3f1e16f](https://github.com/GMOD/mobx-state-tree/commit/3f1e16f455066ee8aabc975ea7bb72e328e3ad00))
34
+ - One workflow, and no run without a reason ([920ee52](https://github.com/GMOD/mobx-state-tree/commit/920ee5280f315b3c3d44d3e7506c0744dbe5638d))
35
+ - Enforce prettier, and keep it away from generated files ([801c920](https://github.com/GMOD/mobx-state-tree/commit/801c9204bed084e3a7031bcfa54cf19acb36e0f7))
36
+ - Pin the toolchain the way the sibling GMOD repos do ([28ec9b0](https://github.com/GMOD/mobx-state-tree/commit/28ec9b0c4a00da23dfedbafe6c8b747d82e933c2))
37
+ - Check every pull request, whatever its base ([b0d8421](https://github.com/GMOD/mobx-state-tree/commit/b0d8421adbec70859f7fa3a74b9e00266cd5cecd))
38
+
39
+ ### Documentation
40
+
41
+ - Update stale mst-reflection note in CLAUDE.md ([b3daf01](https://github.com/GMOD/mobx-state-tree/commit/b3daf010bb4e6bad2fe688d55de16473774dec14))
42
+ - Scale caveat on ADR 0005 — 262 hydrated schemas is an upper bound ([9c2fccc](https://github.com/GMOD/mobx-state-tree/commit/9c2fccc065a021eb4bafd6d6cc1e9386dea3522f))
43
+
44
+ ### Features
45
+
46
+ - Late-bound membership via a members thunk, plus a name option ([af4084d](https://github.com/GMOD/mobx-state-tree/commit/af4084d35a40783c9af5fce6ee7c18b155e8b12f))
47
+ - Extend types.compose to 11 model parts ([854d3f2](https://github.com/GMOD/mobx-state-tree/commit/854d3f2c6dd8bb13c0be28eb9ce0a8390bcf0992))
48
+
49
+ ### Performance Improvements
50
+
51
+ - Hoist ModelType closure fields; stripDefault and union quick-match fast paths ([37a27ce](https://github.com/GMOD/mobx-state-tree/commit/37a27ce992a9e65d92b711129f1e92e6e2ec42bc))
52
+ - Intern no-options unions on their member-identity tuple ([f0c516f](https://github.com/GMOD/mobx-state-tree/commit/f0c516f410cea8a42f68f50b497d627ee0cc5e6b))
53
+
54
+ ### Refactoring
55
+
56
+ - Dead-code and consistency sweep ([7c14475](https://github.com/GMOD/mobx-state-tree/commit/7c1447565f470dc440622ee01a7e2a2395b0b11d))
57
+ - Default BaseType.describe to the type name; drop nine equivalent overrides ([837350e](https://github.com/GMOD/mobx-state-tree/commit/837350e2ee9c38e80cf51ef288f5a09178eaad9a))
58
+
59
+ ### Tests
60
+
61
+ - Stop the timer test rounding its way to a failure ([b24bcf5](https://github.com/GMOD/mobx-state-tree/commit/b24bcf5ef25bd927624c7cecba7ef1aed43f4732))
62
+ - Fix what typechecking the suite turns up ([982bf00](https://github.com/GMOD/mobx-state-tree/commit/982bf00d3cfbd5d4c08e9f07fcd498b09d7f54d6))
63
+ - Typecheck the test suite in CI ([d785a10](https://github.com/GMOD/mobx-state-tree/commit/d785a10bceef5e424dfba1ba97b92c0f3037e63b))
64
+
65
+ ### Types
66
+
67
+ - Guard signatures, variadic union(), readonly validation results, stricter tsconfig ([43b086e](https://github.com/GMOD/mobx-state-tree/commit/43b086e1612a90e9264c99bfdc52710aab3fba38))
68
+ - Restore generic-member inference with a leading 2-arity overload ([4759372](https://github.com/GMOD/mobx-state-tree/commit/475937291d73861f05492f369c425cf4c8d59dd1))
69
+ - Allow a zero-arg create() when the type defaults its own snapshot ([800ce20](https://github.com/GMOD/mobx-state-tree/commit/800ce2098a91933a040cb557af4ceee4a79baf9a))
70
+
1
71
  ## [6.5.1](https://github.com/GMOD/mobx-state-tree/compare/v6.5.0...v6.5.1) (2026-08-22)
2
72
 
3
73
  ### Chores
package/dist/index.d.ts CHANGED
@@ -339,7 +339,9 @@ declare function tryResolve<T = any>(target: IAnyStateTreeNode, path: string): T
339
339
  declare function getRelativePath(base: IAnyStateTreeNode, target: IAnyStateTreeNode): string;
340
340
  /**
341
341
  * Returns a deep copy of the given state tree node as new tree.
342
- * Shorthand for `snapshot(x) = getType(x).create(getSnapshot(x))`
342
+ * Like `getType(x).create(getSnapshot(x))`, except that a node wrapped in a
343
+ * `types.snapshotProcessor` is recreated through the processor, which
344
+ * `getType(x)` (the wrapped type) would skip.
343
345
  *
344
346
  * _Tip: clone will create a literal copy, including the same identifiers. To modify identifiers etc. during cloning, don't use clone but take a snapshot of the tree, modify it, and create new instance_
345
347
  *
@@ -515,13 +517,7 @@ declare function castToReferenceSnapshot<I>(instance: I): Extract<I, IAnyStateTr
515
517
  */
516
518
  declare function getNodeId(target: IAnyStateTreeNode): number;
517
519
 
518
- type HookSubscribers = {
519
- [Hook.afterAttach]: (node: AnyNode, hook: Hook) => void;
520
- [Hook.afterCreate]: (node: AnyNode, hook: Hook) => void;
521
- [Hook.afterCreationFinalization]: (node: AnyNode, hook: Hook) => void;
522
- [Hook.beforeDestroy]: (node: AnyNode, hook: Hook) => void;
523
- [Hook.beforeDetach]: (node: AnyNode, hook: Hook) => void;
524
- };
520
+ type HookSubscriber = (subject: AnyNode, hook: Hook) => void;
525
521
  /**
526
522
  * @internal
527
523
  * @hidden
@@ -544,8 +540,16 @@ declare abstract class BaseNode<C, S, T> {
544
540
  set state(val: NodeLifeCycle);
545
541
  private _hookSubscribers?;
546
542
  protected abstract fireHook(name: Hook): void;
547
- protected fireInternalHook(name: Hook): void;
548
- registerHook<H extends Hook>(hook: H, hookHandler: HookSubscribers[H]): IDisposer;
543
+ protected fireInternalHook(name: Hook, subject?: AnyNode): void;
544
+ /**
545
+ * Detaching a node takes its whole subtree out of the tree, but only the
546
+ * detached node's parent changes, so only it fires `beforeDetach` for real.
547
+ * Internal subscribers below it (reference watchers on a target) still need
548
+ * to know their node is leaving.
549
+ */
550
+ notifyDetachOf(subject: AnyObjectNode): void;
551
+ isWithin(ancestor: AnyNode): boolean;
552
+ registerHook(hook: Hook, hookHandler: HookSubscriber): IDisposer;
549
553
  private _parent;
550
554
  get parent(): AnyObjectNode | null;
551
555
  constructor(type: IAnyType, parent: AnyObjectNode | null, subpath: string, environment: any);
@@ -562,7 +566,7 @@ declare abstract class BaseNode<C, S, T> {
562
566
  get isAlive(): boolean;
563
567
  get isDetaching(): boolean;
564
568
  get observableIsAlive(): boolean;
565
- abstract die(): void;
569
+ die(): void;
566
570
  abstract finalizeCreation(): void;
567
571
  protected baseFinalizeCreation(whenFinalized?: () => void): void;
568
572
  abstract finalizeDeath(): void;
@@ -598,6 +602,7 @@ declare class ObjectNode<C, S, T> extends BaseNode<C, S, T> {
598
602
  isProtectionEnabled: boolean;
599
603
  middlewares?: IMiddleware[];
600
604
  hasSnapshotPostProcessor: boolean;
605
+ snapshotProcessorType?: IAnyType;
601
606
  private _applyPatches?;
602
607
  applyPatches(patches: ReadonlyArray<IJsonPatch>): void;
603
608
  private _applySnapshot?;
@@ -617,6 +622,8 @@ declare class ObjectNode<C, S, T> extends BaseNode<C, S, T> {
617
622
  createObservableInstance(fireHooks?: boolean): void;
618
623
  get root(): AnyObjectNode;
619
624
  clearParent(): void;
625
+ notifyDetachOf(subject: AnyObjectNode): void;
626
+ private notifyChildrenOfDetach;
620
627
  setParent(newParent: AnyObjectNode, subpath: string): void;
621
628
  protected fireHook(name: Hook): void;
622
629
  private _snapshotUponDeath?;
@@ -649,7 +656,6 @@ declare class ObjectNode<C, S, T> extends BaseNode<C, S, T> {
649
656
  finalizeCreation(): void;
650
657
  detach(): void;
651
658
  private preboot;
652
- die(): void;
653
659
  aboutToDie(): void;
654
660
  finalizeDeath(): void;
655
661
  onSnapshot(onChange: (snapshot: S) => void): IDisposer;
@@ -665,13 +671,7 @@ declare class ObjectNode<C, S, T> extends BaseNode<C, S, T> {
665
671
  private _addSnapshotReaction;
666
672
  private _removeSnapshotReaction;
667
673
  private _internalEvents?;
668
- private _internalEventsHasSubscribers;
669
- private _internalEventsRegister;
670
- private _internalEventsHas;
671
- private _internalEventsUnregister;
672
- private _internalEventsEmit;
673
- private _internalEventsClear;
674
- private _internalEventsClearAll;
674
+ private internalEvents;
675
675
  }
676
676
  /**
677
677
  * @internal
@@ -735,9 +735,12 @@ interface IType<C, S, T> {
735
735
  /** @hidden */
736
736
  readonly [$type]: undefined;
737
737
  /**
738
- * Friendly type name.
738
+ * Friendly type name. Read-only: types are shared (unions built from the
739
+ * same members are the same object), so renaming one renames it everywhere.
740
+ * Name a type where it is built instead — `types.model(name, ...)`,
741
+ * `.named()`, or the `name` option of `union`/`snapshotProcessor`.
739
742
  */
740
- name: string;
743
+ readonly name: string;
741
744
  /**
742
745
  * Name of the identifier attribute or null if none.
743
746
  */
@@ -997,6 +1000,24 @@ declare abstract class ComplexType<C, S, T> extends BaseType<C, S, T, ObjectNode
997
1000
  * @returns `true` if the value is a type.
998
1001
  */
999
1002
  declare function isType(value: unknown): value is IAnyType;
1003
+ /**
1004
+ * The one type a wrapper hands everything to: what an `optional`,
1005
+ * `stripDefault`, `refinement`, `snapshotProcessor` or (resolved) `late`
1006
+ * wraps. `undefined` for any other type, including a union or a `resilient`,
1007
+ * which pick a type per value.
1008
+ *
1009
+ * Resolves a `late` type's definition if it has not been read yet.
1010
+ */
1011
+ declare function getWrappedType(type: IAnyType): IAnyType | undefined;
1012
+ /**
1013
+ * Strips every wrapper {@link getWrappedType} sees through, down to the type
1014
+ * that actually builds the value: for a complex type `T`,
1015
+ * `getType(T.create(snapshot)) === unwrapType(T)`.
1016
+ *
1017
+ * `types.model({ xs: types.array(X) }).properties.xs`, for instance, is an
1018
+ * `optional` whose unwrapped type is the array type.
1019
+ */
1020
+ declare function unwrapType(type: IAnyType): IAnyType;
1000
1021
 
1001
1022
  interface IActionTrackingMiddlewareHooks<T> {
1002
1023
  filter?: (call: IMiddlewareEvent) => boolean;
@@ -1574,12 +1595,15 @@ interface IMSTMap<IT extends IAnyType> {
1574
1595
  */
1575
1596
  declare function map<IT extends IAnyType>(subtype: IT): IMapType<IT>;
1576
1597
  /**
1577
- * Returns if a given value represents a map type.
1578
- *
1579
- * @param type
1580
- * @returns `true` if it is a map type.
1598
+ * Returns if a type is a map type, or wraps or unions one. For the map type
1599
+ * itself, use {@link asMapType}.
1581
1600
  */
1582
- declare function isMapType<Items extends IAnyType = IAnyType>(type: IAnyType): type is IMapType<Items>;
1601
+ declare function isMapType(type: IAnyType): boolean;
1602
+ /**
1603
+ * The map type `type` builds its values with, seeing through the wrappers
1604
+ * {@link unwrapType} does, or `undefined` if that is not a map type.
1605
+ */
1606
+ declare function asMapType(type: IAnyType): IMapType<IAnyType> | undefined;
1583
1607
 
1584
1608
  /** @hidden */
1585
1609
  interface IMSTArray<IT extends IAnyType> extends IObservableArray<IT["Type"]> {
@@ -1597,7 +1621,7 @@ interface IMSTArray<IT extends IAnyType> extends IObservableArray<IT["Type"]> {
1597
1621
  }
1598
1622
  /** @hidden */
1599
1623
  interface IArrayType<IT extends IAnyType> extends IType<readonly IT["CreationType"][] | undefined, IT["SnapshotType"][], IMSTArray<IT>> {
1600
- hooks(hooks: IHooksGetter<IMSTArray<IAnyType>>): IArrayType<IT>;
1624
+ hooks(hooks: IHooksGetter<IMSTArray<IT>>): IArrayType<IT>;
1601
1625
  /** the element type of the array */
1602
1626
  getChildType(): IAnyType;
1603
1627
  }
@@ -1627,12 +1651,15 @@ interface IArrayType<IT extends IAnyType> extends IType<readonly IT["CreationTyp
1627
1651
  */
1628
1652
  declare function array<IT extends IAnyType>(subtype: IT): IArrayType<IT>;
1629
1653
  /**
1630
- * Returns if a given value represents an array type.
1631
- *
1632
- * @param type
1633
- * @returns `true` if the type is an array type.
1654
+ * Returns if a type is an array type, or wraps or unions one. For the array
1655
+ * type itself, use {@link asArrayType}.
1656
+ */
1657
+ declare function isArrayType(type: IAnyType): boolean;
1658
+ /**
1659
+ * The array type `type` builds its values with, seeing through the wrappers
1660
+ * {@link unwrapType} does, or `undefined` if that is not an array type.
1634
1661
  */
1635
- declare function isArrayType<Items extends IAnyType = IAnyType>(type: IAnyType): type is IArrayType<Items>;
1662
+ declare function asArrayType(type: IAnyType): IArrayType<IAnyType> | undefined;
1636
1663
 
1637
1664
  /** @hidden */
1638
1665
  interface ModelProperties {
@@ -1693,6 +1720,16 @@ type ExtractCFromProps<P extends ModelProperties> = {
1693
1720
  */
1694
1721
  type _OverrideProps<PA extends ModelProperties, PB extends ModelProperties> = Omit<PA, keyof PB> & PB;
1695
1722
  /** @hidden */
1723
+ type _IsAny<T> = 0 extends 1 & T ? true : false;
1724
+ /**
1725
+ * Snapshot processors own only the keys they were written for and pass the
1726
+ * rest through, so a processor earlier in a model's chain also carries props
1727
+ * added after it. Added props therefore replace their keys in a customized
1728
+ * creation or snapshot type; an uncustomized one stays uncustomized.
1729
+ * @hidden
1730
+ */
1731
+ type _WithAddedKeys<Custom, Added> = _IsAny<Custom> extends true ? Custom : [Custom] extends [_NotCustomized] ? _NotCustomized : Omit<Custom, keyof Added> & Added;
1732
+ /** @hidden */
1696
1733
  type ModelCreationType<PC> = MaybeEmpty<{
1697
1734
  [P in DefinablePropsNames<PC>]: PC[P];
1698
1735
  }> & Partial<PC>;
@@ -1723,7 +1760,7 @@ interface ModelActions {
1723
1760
  interface IModelType<PROPS extends ModelProperties, OTHERS, CustomC = _NotCustomized, CustomS = _NotCustomized> extends IType<ModelCreationType2<PROPS, CustomC>, ModelSnapshotType2<PROPS, CustomS>, ModelInstanceType<PROPS, OTHERS>> {
1724
1761
  readonly properties: PROPS;
1725
1762
  named(newName: string): IModelType<PROPS, OTHERS, CustomC, CustomS>;
1726
- props<PROPS2 extends ModelPropertiesDeclaration>(props: PROPS2): IModelType<_OverrideProps<PROPS, ModelPropertiesDeclarationToProperties<PROPS2>>, OTHERS, CustomC, CustomS>;
1763
+ props<PROPS2 extends ModelPropertiesDeclaration>(props: PROPS2): IModelType<_OverrideProps<PROPS, ModelPropertiesDeclarationToProperties<PROPS2>>, OTHERS, _WithAddedKeys<CustomC, ModelCreationType<ExtractCFromProps<ModelPropertiesDeclarationToProperties<PROPS2>>>>, _WithAddedKeys<CustomS, ModelSnapshotType<ModelPropertiesDeclarationToProperties<PROPS2>>>>;
1727
1764
  views<V extends object>(fn: (self: Instance<this>) => V): IModelType<PROPS, OTHERS & V, CustomC, CustomS>;
1728
1765
  actions<A extends ModelActions>(fn: (self: Instance<this>) => A): IModelType<PROPS, OTHERS & A, CustomC, CustomS>;
1729
1766
  volatile<TP extends object>(fn: (self: Instance<this>) => TP): IModelType<PROPS, OTHERS & TP, CustomC, CustomS>;
@@ -1743,30 +1780,54 @@ interface IAnyModelType extends IModelType<any, any, any, any> {
1743
1780
  declare function model<P extends ModelPropertiesDeclaration = {}>(name: string, properties?: P): IModelType<ModelPropertiesDeclarationToProperties<P>, {}>;
1744
1781
  declare function model<P extends ModelPropertiesDeclaration = {}>(properties?: P): IModelType<ModelPropertiesDeclarationToProperties<P>, {}>;
1745
1782
  /** @hidden */
1746
- type _CustomJoin<A, B> = A extends _NotCustomized ? B : A & B;
1747
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>): IModelType<_OverrideProps<PA, PB>, OA & OB, _CustomJoin<FCA, FCB>, _CustomJoin<FSA, FSB>>;
1748
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>): IModelType<_OverrideProps<PA, PB>, OA & OB, _CustomJoin<FCA, FCB>, _CustomJoin<FSA, FSB>>;
1749
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>): IModelType<_OverrideProps<_OverrideProps<PA, PB>, PC>, OA & OB & OC, _CustomJoin<FCA, _CustomJoin<FCB, FCC>>, _CustomJoin<FSA, _CustomJoin<FSB, FSC>>>;
1750
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>): IModelType<_OverrideProps<_OverrideProps<PA, PB>, PC>, OA & OB & OC, _CustomJoin<FCA, _CustomJoin<FCB, FCC>>, _CustomJoin<FSA, _CustomJoin<FSB, FSC>>>;
1751
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>): IModelType<_OverrideProps<_OverrideProps<_OverrideProps<PA, PB>, PC>, PD>, OA & OB & OC & OD, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, FCD>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, FSD>>>>;
1752
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>): IModelType<_OverrideProps<_OverrideProps<_OverrideProps<PA, PB>, PC>, PD>, OA & OB & OC & OD, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, FCD>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, FSD>>>>;
1753
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>): IModelType<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<PA, PB>, PC>, PD>, PE>, OA & OB & OC & OD & OE, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, FCE>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, FSE>>>>>;
1754
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>): IModelType<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<PA, PB>, PC>, PD>, PE>, OA & OB & OC & OD & OE, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, FCE>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, FSE>>>>>;
1755
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>): IModelType<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<PA, PB>, PC>, PD>, PE>, PF>, OA & OB & OC & OD & OE & OF, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, FCF>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, FSF>>>>>>;
1756
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>): IModelType<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<PA, PB>, PC>, PD>, PE>, PF>, OA & OB & OC & OD & OE & OF, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, FCF>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, FSF>>>>>>;
1757
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>): IModelType<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<PA, PB>, PC>, PD>, PE>, PF>, PG>, OA & OB & OC & OD & OE & OF & OG, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, FCG>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, FSG>>>>>>>;
1758
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>): IModelType<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<PA, PB>, PC>, PD>, PE>, PF>, PG>, OA & OB & OC & OD & OE & OF & OG, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, FCG>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, FSG>>>>>>>;
1759
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>): IModelType<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<PA, PB>, PC>, PD>, PE>, PF>, PG>, PH>, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, FCH>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, FSH>>>>>>>>;
1760
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>): IModelType<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<PA, PB>, PC>, PD>, PE>, PF>, PG>, PH>, OA & OB & OC & OD & OE & OF & OG & OH, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, FCH>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, FSH>>>>>>>>;
1761
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH, PI extends ModelProperties, OI, FCI, FSI>(name: string, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>, I: IModelType<PI, OI, FCI, FSI>): IModelType<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<PA, PB>, PC>, PD>, PE>, PF>, PG>, PH>, PI>, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, _CustomJoin<FCH, FCI>>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, _CustomJoin<FSH, FSI>>>>>>>>>;
1762
- declare function compose<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD, PE extends ModelProperties, OE, FCE, FSE, PF extends ModelProperties, OF, FCF, FSF, PG extends ModelProperties, OG, FCG, FSG, PH extends ModelProperties, OH, FCH, FSH, PI extends ModelProperties, OI, FCI, FSI>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>, E: IModelType<PE, OE, FCE, FSE>, F: IModelType<PF, OF, FCF, FSF>, G: IModelType<PG, OG, FCG, FSG>, H: IModelType<PH, OH, FCH, FSH>, I: IModelType<PI, OI, FCI, FSI>): IModelType<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<_OverrideProps<PA, PB>, PC>, PD>, PE>, PF>, PG>, PH>, PI>, OA & OB & OC & OD & OE & OF & OG & OH & OI, _CustomJoin<FCA, _CustomJoin<FCB, _CustomJoin<FCC, _CustomJoin<FCD, _CustomJoin<FCE, _CustomJoin<FCF, _CustomJoin<FCG, _CustomJoin<FCH, FCI>>>>>>>>, _CustomJoin<FSA, _CustomJoin<FSB, _CustomJoin<FSC, _CustomJoin<FSD, _CustomJoin<FSE, _CustomJoin<FSF, _CustomJoin<FSG, _CustomJoin<FSH, FSI>>>>>>>>>;
1763
- /**
1764
- * Returns if a given value represents a model type.
1765
- *
1766
- * @param type
1767
- * @returns
1783
+ type _ComposableParts = readonly [
1784
+ IAnyModelType,
1785
+ IAnyModelType,
1786
+ ...IAnyModelType[]
1787
+ ];
1788
+ /**
1789
+ * Props override left to right, as `compose` merges them at runtime.
1790
+ * @hidden
1791
+ */
1792
+ type _ComposedProps<Acc extends ModelProperties, Rest> = Rest extends readonly [IModelType<infer P, any, any, any>, ...infer Tail] ? _ComposedProps<_OverrideProps<Acc, P>, Tail> : Acc;
1793
+ /** @hidden */
1794
+ type _ComposedOthers<Parts> = Parts extends readonly [
1795
+ IModelType<any, infer O, any, any>,
1796
+ ...infer Tail
1797
+ ] ? O & _ComposedOthers<Tail> : unknown;
1798
+ /**
1799
+ * A composed part's snapshot processors are handed the whole snapshot but own
1800
+ * only their part's keys, passing the other parts' through — the only way a
1801
+ * part can process without knowing what it is composed with. So a part with a
1802
+ * custom creation (`"C"`) or snapshot (`"S"`) type replaces its own props' keys
1803
+ * in the merged type. `_NotCustomized` when no part customizes.
1804
+ * @hidden
1805
+ */
1806
+ type _ComposedCustom<Parts, Which extends "C" | "S", Acc, Customized extends boolean = false> = Parts extends readonly [
1807
+ IModelType<infer P, any, infer C, infer S>,
1808
+ ...infer Tail
1809
+ ] ? (Which extends "C" ? C : S) extends _NotCustomized ? _ComposedCustom<Tail, Which, Acc, Customized> : _ComposedCustom<Tail, Which, Omit<Acc, keyof P> & (Which extends "C" ? C : S), true> : Customized extends true ? Acc : _NotCustomized;
1810
+ /** @hidden */
1811
+ type _ComposedModel<Props extends ModelProperties, Parts> = IModelType<Props, _ComposedOthers<Parts>, _ComposedCustom<Parts, "C", ModelCreationType<ExtractCFromProps<Props>>>, _ComposedCustom<Parts, "S", ModelSnapshotType<Props>>>;
1812
+ /** @hidden */
1813
+ /**
1814
+ * A part typed `any` makes the composition `any`-shaped: inferring from `any`
1815
+ * would yield the parameters' constraints instead, an empty model.
1816
+ * @hidden
1768
1817
  */
1769
- declare function isModelType<IT extends IAnyModelType = IAnyModelType>(type: IAnyType): type is IT;
1818
+ type _Composed<Parts extends _ComposableParts> = true extends _IsAny<Parts[number]> ? IAnyModelType : Parts extends readonly [IModelType<infer P, any, any, any>, ...infer Tail] ? _ComposedModel<_ComposedProps<P, Tail>, Parts> : never;
1819
+ declare function compose<Parts extends _ComposableParts>(name: string, ...parts: Parts): _Composed<Parts>;
1820
+ declare function compose<Parts extends _ComposableParts>(...parts: Parts): _Composed<Parts>;
1821
+ /**
1822
+ * Returns if a type is a model type, or wraps or unions one. For the model
1823
+ * type itself, use {@link asModelType}.
1824
+ */
1825
+ declare function isModelType(type: IAnyType): boolean;
1826
+ /**
1827
+ * The model type `type` builds its values with, seeing through the wrappers
1828
+ * {@link unwrapType} does, or `undefined` if that is not a model type.
1829
+ */
1830
+ declare function asModelType(type: IAnyType): IAnyModelType | undefined;
1770
1831
  /**
1771
1832
  * `extendInstance` - attaches additional actions, views and volatile state to an
1772
1833
  * already-created model instance, using the same instantiation machinery as
@@ -1796,11 +1857,9 @@ declare function extendInstance<T extends IAnyStateTreeNode>(instance: T, fn: (s
1796
1857
  /**
1797
1858
  * Returns if a given value represents a primitive type.
1798
1859
  *
1799
- * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
1800
- * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
1801
- * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
1802
- * to compile. Guards with a distinct narrowing target (`isArrayType`,
1803
- * `isMapType`, `isModelType`) keep their predicate.
1860
+ * Like every `isXType` guard it reads the type's flags, which wrappers and
1861
+ * unions inherit from what they hold, so it is also true for a type that wraps
1862
+ * or unions one. Use {@link unwrapType} to get at the type itself.
1804
1863
  *
1805
1864
  * @param type
1806
1865
  * @returns
@@ -1835,11 +1894,9 @@ declare function literal<S extends Primitives>(value: S): ILiteralType<S>;
1835
1894
  /**
1836
1895
  * Returns if a given value represents a literal type.
1837
1896
  *
1838
- * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
1839
- * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
1840
- * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
1841
- * to compile. Guards with a distinct narrowing target (`isArrayType`,
1842
- * `isMapType`, `isModelType`) keep their predicate.
1897
+ * Like every `isXType` guard it reads the type's flags, which wrappers and
1898
+ * unions inherit from what they hold, so it is also true for a type that wraps
1899
+ * or unions one. Use {@link unwrapType} to get at the type itself.
1843
1900
  *
1844
1901
  * @param type
1845
1902
  * @returns
@@ -1851,11 +1908,9 @@ declare function refinement<IT extends IAnyType>(type: IT, predicate: (snapshot:
1851
1908
  /**
1852
1909
  * Returns if a given value is a refinement type.
1853
1910
  *
1854
- * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
1855
- * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
1856
- * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
1857
- * to compile. Guards with a distinct narrowing target (`isArrayType`,
1858
- * `isMapType`, `isModelType`) keep their predicate.
1911
+ * Like every `isXType` guard it reads the type's flags, which wrappers and
1912
+ * unions inherit from what they hold, so it is also true for a type that wraps
1913
+ * or unions one. Use {@link unwrapType} to get at the type itself.
1859
1914
  *
1860
1915
  * @param type
1861
1916
  * @returns
@@ -1864,8 +1919,8 @@ declare function isRefinementType(type: IAnyType): boolean;
1864
1919
 
1865
1920
  /** @hidden */
1866
1921
  type UnionStringArray<T extends readonly string[]> = T[number];
1867
- declare function enumeration<T extends readonly string[]>(options: T): ISimpleType<UnionStringArray<T>>;
1868
- declare function enumeration<T extends string>(name: string, options: T[]): ISimpleType<UnionStringArray<T[]>>;
1922
+ declare function enumeration<T extends string>(options: readonly T[]): ISimpleType<T>;
1923
+ declare function enumeration<T extends string>(name: string, options: readonly T[]): ISimpleType<T>;
1869
1924
 
1870
1925
  type ITypeDispatcher = (snapshot: any) => IAnyType;
1871
1926
  interface UnionOptions {
@@ -1905,24 +1960,18 @@ declare function union(dispatchOrType: UnionOptions | IAnyType, ...otherTypes: I
1905
1960
  /**
1906
1961
  * Returns if a given value represents a union type.
1907
1962
  *
1908
- * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
1909
- * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
1910
- * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
1911
- * to compile. Guards with a distinct narrowing target (`isArrayType`,
1912
- * `isMapType`, `isModelType`) keep their predicate.
1963
+ * Like every `isXType` guard it reads the type's flags, which wrappers and
1964
+ * unions inherit from what they hold, so it is also true for a type that wraps
1965
+ * or unions one. Use {@link unwrapType} to get at the type itself.
1913
1966
  *
1914
1967
  * @param type
1915
1968
  * @returns
1916
1969
  */
1917
1970
  declare function isUnionType(type: IAnyType): boolean;
1918
1971
  /**
1919
- * Returns the member types of a union.
1920
- *
1921
- * Wrapper types (`optional`, `refinement`, `late`) inherit the union flag from
1922
- * the type they wrap, so `isUnionType` is true for e.g. an optional-of-union,
1923
- * but their `getSubTypes()` reports the single wrapped type rather than the
1924
- * union's members. This drills through those wrappers until the union's member
1925
- * array surfaces.
1972
+ * Returns the member types of a union, seeing through the wrappers
1973
+ * {@link unwrapType} does: `isUnionType` is also true for e.g. an
1974
+ * optional-of-union.
1926
1975
  *
1927
1976
  * @param type a type for which `isUnionType` is true
1928
1977
  * @returns the array of member types of the underlying union
@@ -1944,11 +1993,9 @@ declare function optional<IT extends IAnyType, OptionalVals extends ValidOptiona
1944
1993
  /**
1945
1994
  * Returns if a value represents an optional type.
1946
1995
  *
1947
- * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
1948
- * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
1949
- * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
1950
- * to compile. Guards with a distinct narrowing target (`isArrayType`,
1951
- * `isMapType`, `isModelType`) keep their predicate.
1996
+ * Like every `isXType` guard it reads the type's flags, which wrappers and
1997
+ * unions inherit from what they hold, so it is also true for a type that wraps
1998
+ * or unions one. Use {@link unwrapType} to get at the type itself.
1952
1999
  *
1953
2000
  * @param type
1954
2001
  * @returns
@@ -1997,11 +2044,9 @@ declare function late<T extends IAnyType>(name: string, type: () => T): T;
1997
2044
  /**
1998
2045
  * Returns if a given value represents a late type.
1999
2046
  *
2000
- * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
2001
- * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
2002
- * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
2003
- * to compile. Guards with a distinct narrowing target (`isArrayType`,
2004
- * `isMapType`, `isModelType`) keep their predicate.
2047
+ * Like every `isXType` guard it reads the type's flags, which wrappers and
2048
+ * unions inherit from what they hold, so it is also true for a type that wraps
2049
+ * or unions one. Use {@link unwrapType} to get at the type itself.
2005
2050
  *
2006
2051
  * @param type
2007
2052
  * @returns
@@ -2020,11 +2065,9 @@ declare function frozen<T = any>(): IType<T, T, T>;
2020
2065
  /**
2021
2066
  * Returns if a given value represents a frozen type.
2022
2067
  *
2023
- * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
2024
- * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
2025
- * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
2026
- * to compile. Guards with a distinct narrowing target (`isArrayType`,
2027
- * `isMapType`, `isModelType`) keep their predicate.
2068
+ * Like every `isXType` guard it reads the type's flags, which wrappers and
2069
+ * unions inherit from what they hold, so it is also true for a type that wraps
2070
+ * or unions one. Use {@link unwrapType} to get at the type itself.
2028
2071
  *
2029
2072
  * @param type
2030
2073
  * @returns
@@ -2061,11 +2104,9 @@ declare function reference<IT extends IAnyComplexType>(subType: IT, options?: Re
2061
2104
  /**
2062
2105
  * Returns if a given value represents a reference type.
2063
2106
  *
2064
- * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
2065
- * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
2066
- * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
2067
- * to compile. Guards with a distinct narrowing target (`isArrayType`,
2068
- * `isMapType`, `isModelType`) keep their predicate.
2107
+ * Like every `isXType` guard it reads the type's flags, which wrappers and
2108
+ * unions inherit from what they hold, so it is also true for a type that wraps
2109
+ * or unions one. Use {@link unwrapType} to get at the type itself.
2069
2110
  *
2070
2111
  * @param type
2071
2112
  * @returns
@@ -2083,11 +2124,9 @@ declare function safeReference<IT extends IAnyComplexType>(subType: IT, options?
2083
2124
  /**
2084
2125
  * Returns if a given value represents an identifier type.
2085
2126
  *
2086
- * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
2087
- * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
2088
- * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
2089
- * to compile. Guards with a distinct narrowing target (`isArrayType`,
2090
- * `isMapType`, `isModelType`) keep their predicate.
2127
+ * Like every `isXType` guard it reads the type's flags, which wrappers and
2128
+ * unions inherit from what they hold, so it is also true for a type that wraps
2129
+ * or unions one. Use {@link unwrapType} to get at the type itself.
2091
2130
  *
2092
2131
  * @param type
2093
2132
  * @returns
@@ -2210,5 +2249,5 @@ declare const types: {
2210
2249
  resilient: typeof resilient;
2211
2250
  };
2212
2251
 
2213
- export { addDisposer, addMiddleware, applyAction, applyPatch, applySnapshot, cannotDetermineSubtype, cast, castFlowReturn, castToReferenceSnapshot, castToSnapshot, clone, createActionTrackingMiddleware, createActionTrackingMiddleware2, decorate, destroy, detach, escapeJsonPath, extendInstance, 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, protect, recordActions, recordPatches, resolveIdentifier, resolvePath, setDevMode, setLivelinessChecking, setLivelynessChecking, setTypeChecking, splitJsonPath, types as t, toGenerator, toGeneratorFunction, tryReference, tryResolve, typecheck, types, unescapeJsonPath, unprotect, walk };
2214
- export type { $EmptyObjectBrand, CustomTypeOptions, IActionContext, IActionRecorder, IActionTrackingMiddleware2Call, IActionTrackingMiddleware2Hooks, IActionTrackingMiddlewareHooks, IAnyComplexType, IAnyModelType, IAnyStateTreeNode, IAnyType, IArrayType, IComplexType, IDisposer, IJsonPatch, ILiteralType, 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 };
2252
+ export { addDisposer, addMiddleware, applyAction, applyPatch, applySnapshot, asArrayType, asMapType, asModelType, cannotDetermineSubtype, cast, castFlowReturn, castToReferenceSnapshot, castToSnapshot, clone, createActionTrackingMiddleware, createActionTrackingMiddleware2, decorate, destroy, detach, escapeJsonPath, extendInstance, flow, getChildType, getEnv, getIdentifier, getLivelinessChecking, getMembers, getNodeId, getParent, getParentOfType, getPath, getPathParts, getPropertyMembers, getRelativePath, getRoot, getRunningActionContext, getSnapshot, getType, getUnionSubtypes, getWrappedType, 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, protect, recordActions, recordPatches, resolveIdentifier, resolvePath, setDevMode, setLivelinessChecking, setLivelynessChecking, setTypeChecking, splitJsonPath, types as t, toGenerator, toGeneratorFunction, tryReference, tryResolve, typecheck, types, unescapeJsonPath, unprotect, unwrapType, walk };
2253
+ export type { $EmptyObjectBrand, CustomTypeOptions, IActionContext, IActionRecorder, IActionTrackingMiddleware2Call, IActionTrackingMiddleware2Hooks, IActionTrackingMiddlewareHooks, IAnyComplexType, IAnyModelType, IAnyStateTreeNode, IAnyType, IArrayType, IComplexType, IDisposer, IHooks, IHooksGetter, IJsonPatch, ILiteralType, IMSTArray, IMSTMap, IMapType, IMaybe, IMaybeIType, IMaybeNull, IMiddlewareEvent, IMiddlewareEventType, IMiddlewareHandler, IModelReflectionData, IModelReflectionPropertiesData, IModelType, IOptionalIType, IPatchRecorder, IReferenceType, IResilientType, IReversibleJsonPatch, ISerializedActionCall, ISimpleType, ISnapshotProcessor, ISnapshotProcessors, IStateTreeNode, IType, ITypeUnion, IValidationContext, IValidationContextEntry, IValidationError, IValidationResult, 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, _CustomOrOther, _NotCustomized };