@jbrowse/mobx-state-tree 6.2.0 → 6.4.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
@@ -284,7 +284,7 @@ declare function isRoot(target: IAnyStateTreeNode): boolean;
284
284
  * @param path escaped json path
285
285
  * @returns
286
286
  */
287
- declare function resolvePath(target: IAnyStateTreeNode, path: string): any;
287
+ declare function resolvePath<T = any>(target: IAnyStateTreeNode, path: string): T | undefined;
288
288
  /**
289
289
  * Resolves a model instance given a root target, the type and the identifier you are searching for.
290
290
  * Returns undefined if no value can be found.
@@ -327,7 +327,7 @@ declare function isValidReference<N extends IAnyStateTreeNode>(getter: () => N |
327
327
  * @param path
328
328
  * @returns
329
329
  */
330
- declare function tryResolve(target: IAnyStateTreeNode, path: string): any;
330
+ declare function tryResolve<T = any>(target: IAnyStateTreeNode, path: string): T | undefined;
331
331
  /**
332
332
  * Given two state tree nodes that are part of the same tree,
333
333
  * returns the shortest jsonpath needed to navigate from the one to the other
@@ -591,7 +591,7 @@ declare class ObjectNode<C, S, T> extends BaseNode<C, S, T> {
591
591
  readonly type: ComplexType<C, S, T>;
592
592
  storedValue: T & IStateTreeNode<IType<C, S, T>>;
593
593
  readonly nodeId: number;
594
- readonly identifierAttribute?: string;
594
+ readonly identifierAttribute?: string | undefined;
595
595
  readonly identifier: string | null;
596
596
  readonly unnormalizedIdentifier: ReferenceIdentifier | null;
597
597
  identifierCache?: IdentifierCache;
@@ -599,7 +599,7 @@ declare class ObjectNode<C, S, T> extends BaseNode<C, S, T> {
599
599
  middlewares?: IMiddleware[];
600
600
  hasSnapshotPostProcessor: boolean;
601
601
  private _applyPatches?;
602
- applyPatches(patches: IJsonPatch[]): void;
602
+ applyPatches(patches: ReadonlyArray<IJsonPatch>): void;
603
603
  private _applySnapshot?;
604
604
  applySnapshot(snapshot: C): void;
605
605
  private _autoUnbox;
@@ -683,8 +683,8 @@ type AnyObjectNode = ObjectNode<any, any, any>;
683
683
  * @hidden
684
684
  */
685
685
  interface AssertAliveContext {
686
- subpath?: string;
687
- actionContext?: IMiddlewareEvent;
686
+ subpath?: string | undefined;
687
+ actionContext?: IMiddlewareEvent | undefined;
688
688
  }
689
689
 
690
690
  /**
@@ -717,8 +717,8 @@ declare enum TypeFlags {
717
717
  Float = 4194304
718
718
  }
719
719
  /**
720
- * @internal
721
- * @hidden
720
+ * The value `getSubTypes()` returns when a type cannot report its subtype,
721
+ * which is distinct from reporting that it has none (`null`).
722
722
  */
723
723
  declare const cannotDetermineSubtype = "cannotDetermine";
724
724
  /**
@@ -741,7 +741,7 @@ interface IType<C, S, T> {
741
741
  /**
742
742
  * Name of the identifier attribute or null if none.
743
743
  */
744
- readonly identifierAttribute?: string;
744
+ readonly identifierAttribute?: string | undefined;
745
745
  /**
746
746
  * Creates an instance for the type given an snapshot input.
747
747
  *
@@ -759,7 +759,7 @@ interface IType<C, S, T> {
759
759
  * @param thing Snapshot or instance to be checked.
760
760
  * @returns true if the value is of the current type, false otherwise.
761
761
  */
762
- is(thing: any): thing is C | this["Type"];
762
+ is(thing: unknown): thing is C | this["Type"];
763
763
  /**
764
764
  * Run's the type's typechecker on the given value with the given validation context.
765
765
  *
@@ -949,11 +949,11 @@ declare abstract class BaseType<C, S, T, N extends BaseNode<any, any, any> = Bas
949
949
  abstract reconcile(current: N, newValue: C | T, parent: AnyObjectNode, subpath: string): N;
950
950
  abstract instantiate(parent: AnyObjectNode | null, subpath: string, environment: any, initialValue: C | T): N;
951
951
  abstract flags: TypeFlags;
952
- abstract describe(): string;
952
+ describe(): string;
953
953
  abstract isValidSnapshot(value: C, context: IValidationContext): IValidationResult;
954
954
  isAssignableFrom(type: IAnyType): boolean;
955
955
  validate(value: C | T, context: IValidationContext): IValidationResult;
956
- is(thing: any): thing is any;
956
+ is(thing: unknown): thing is any;
957
957
  get Type(): any;
958
958
  get TypeWithoutSTN(): any;
959
959
  get SnapshotType(): any;
@@ -967,7 +967,7 @@ declare abstract class BaseType<C, S, T, N extends BaseNode<any, any, any> = Bas
967
967
  * @hidden
968
968
  */
969
969
  declare abstract class ComplexType<C, S, T> extends BaseType<C, S, T, ObjectNode<C, S, T>> {
970
- identifierAttribute?: string;
970
+ identifierAttribute?: string | undefined;
971
971
  create(snapshot?: C, environment?: any): any;
972
972
  getValue(node: this["N"]): T;
973
973
  abstract getDefaultSnapshot(): C;
@@ -992,7 +992,7 @@ declare abstract class ComplexType<C, S, T> extends BaseType<C, S, T, ObjectNode
992
992
  * @param value Value to check.
993
993
  * @returns `true` if the value is a type.
994
994
  */
995
- declare function isType(value: any): value is IAnyType;
995
+ declare function isType(value: unknown): value is IAnyType;
996
996
 
997
997
  interface IActionTrackingMiddlewareHooks<T> {
998
998
  filter?: (call: IMiddlewareEvent) => boolean;
@@ -1020,7 +1020,7 @@ declare function createActionTrackingMiddleware<T = any>(hooks: IActionTrackingM
1020
1020
 
1021
1021
  interface IActionTrackingMiddleware2Call<TEnv> extends Readonly<IActionContext> {
1022
1022
  env: TEnv | undefined;
1023
- readonly parentCall?: IActionTrackingMiddleware2Call<TEnv>;
1023
+ readonly parentCall?: IActionTrackingMiddleware2Call<TEnv> | undefined;
1024
1024
  }
1025
1025
  interface IActionTrackingMiddleware2Hooks<TEnv> {
1026
1026
  filter?: (call: IActionTrackingMiddleware2Call<TEnv>) => boolean;
@@ -1153,9 +1153,9 @@ interface IMiddlewareEvent extends IActionContext {
1153
1153
  readonly allParentIds: number[];
1154
1154
  }
1155
1155
  type FunctionWithFlag = ((...args: any[]) => any) & {
1156
- _isMSTAction?: boolean;
1157
- _isFlowAction?: boolean;
1158
- $mst_middleware?: IMiddleware[];
1156
+ _isMSTAction?: boolean | undefined;
1157
+ _isFlowAction?: boolean | undefined;
1158
+ $mst_middleware?: IMiddleware[] | undefined;
1159
1159
  };
1160
1160
  /**
1161
1161
  * @internal
@@ -1245,10 +1245,10 @@ interface IValidationError {
1245
1245
  /** Value that was being validated, either a snapshot or an instance */
1246
1246
  value: any;
1247
1247
  /** Error message */
1248
- message?: string;
1248
+ message?: string | undefined;
1249
1249
  }
1250
1250
  /** Type validation result, which is an array of type validation errors */
1251
- type IValidationResult = IValidationError[];
1251
+ type IValidationResult = ReadonlyArray<IValidationError>;
1252
1252
  /**
1253
1253
  * Run's the typechecker for the given type on the given value, which can be a snapshot or an instance.
1254
1254
  * Throws if the given value is not according the provided type specification.
@@ -1315,7 +1315,7 @@ interface IAnyStateTreeNode extends STNValue<any, IAnyType> {
1315
1315
  * @param value
1316
1316
  * @returns true if the value is a state tree node.
1317
1317
  */
1318
- declare function isStateTreeNode<IT extends IAnyComplexType = IAnyComplexType>(value: any): value is STNValue<Instance<IT>, IT>;
1318
+ declare function isStateTreeNode<IT extends IAnyComplexType = IAnyComplexType>(value: unknown): value is STNValue<Instance<IT>, IT>;
1319
1319
 
1320
1320
  /**
1321
1321
  * @hidden
@@ -1508,6 +1508,11 @@ interface IMapType<IT extends IAnyType> extends IType<IKeyValueMap<IT["CreationT
1508
1508
  /** the value type of the map */
1509
1509
  getChildType(): IAnyType;
1510
1510
  }
1511
+ /**
1512
+ * The forms `merge` and `replace` accept, mirroring mobx's
1513
+ * `IObservableMapInitialValues` with MST's snapshot-or-instance value type.
1514
+ */
1515
+ type IMSTMapInitialValues<IT extends IAnyType> = IMSTMap<IType<any, any, IT["TypeWithoutSTN"]>> | IKeyValueMap<ExtractCSTWithSTN<IT>> | Map<string | number, ExtractCSTWithSTN<IT>> | readonly (readonly [string | number, ExtractCSTWithSTN<IT>])[];
1511
1516
  /** @hidden */
1512
1517
  interface IMSTMap<IT extends IAnyType> {
1513
1518
  clear(): void;
@@ -1523,8 +1528,8 @@ interface IMSTMap<IT extends IAnyType> {
1523
1528
  entries(): IterableIterator<[string, IT["Type"]]>;
1524
1529
  [Symbol.iterator](): IterableIterator<[string, IT["Type"]]>;
1525
1530
  /** Merge another object into this map, returns self. */
1526
- merge(other: IMSTMap<IType<any, any, IT["TypeWithoutSTN"]>> | IKeyValueMap<ExtractCSTWithSTN<IT>> | any): this;
1527
- replace(values: IMSTMap<IType<any, any, IT["TypeWithoutSTN"]>> | IKeyValueMap<ExtractCSTWithSTN<IT>> | any): this;
1531
+ merge(other?: IMSTMapInitialValues<IT>): this;
1532
+ replace(values: IMSTMapInitialValues<IT>): this;
1528
1533
  toJSON(): IKeyValueMap<IT["SnapshotType"]>;
1529
1534
  toString(): string;
1530
1535
  [Symbol.toStringTag]: "Map";
@@ -1784,27 +1789,28 @@ declare function extendInstance<T extends IAnyStateTreeNode>(instance: T, fn: (s
1784
1789
  state?: object;
1785
1790
  }): T;
1786
1791
 
1787
- /**
1788
- * `types.Date` - Creates a type that can only contain a javascript Date value.
1789
- *
1790
- * Example:
1791
- * ```ts
1792
- * const LogLine = types.model({
1793
- * timestamp: types.Date,
1794
- * })
1795
- *
1796
- * LogLine.create({ timestamp: new Date() })
1797
- * ```
1798
- */
1799
- declare const DatePrimitive: IType<number | Date, number, Date>;
1800
1792
  /**
1801
1793
  * Returns if a given value represents a primitive type.
1802
1794
  *
1795
+ * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
1796
+ * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
1797
+ * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
1798
+ * to compile. Guards with a distinct narrowing target (`isArrayType`,
1799
+ * `isMapType`, `isModelType`) keep their predicate.
1800
+ *
1803
1801
  * @param type
1804
1802
  * @returns
1805
1803
  */
1806
- declare function isPrimitiveType<IT extends ISimpleType<string> | ISimpleType<number> | ISimpleType<boolean> | typeof DatePrimitive>(type: IT): type is IT;
1804
+ declare function isPrimitiveType(type: IAnyType): boolean;
1807
1805
 
1806
+ /**
1807
+ * A literal type, which additionally publishes the exact value it matches.
1808
+ * `getUnionSubtypes` of an enumeration returns these, so the members can be
1809
+ * mapped back to their values without a hand-declared interface.
1810
+ */
1811
+ interface ILiteralType<S extends Primitives> extends ISimpleType<S> {
1812
+ readonly value: S;
1813
+ }
1808
1814
  /**
1809
1815
  * `types.literal` - The literal type will return a type that will match only the exact given type.
1810
1816
  * The given value must be a primitive, in order to be serialized to a snapshot correctly.
@@ -1821,24 +1827,36 @@ declare function isPrimitiveType<IT extends ISimpleType<string> | ISimpleType<nu
1821
1827
  * @param value The value to use in the strict equal check
1822
1828
  * @returns
1823
1829
  */
1824
- declare function literal<S extends Primitives>(value: S): ISimpleType<S>;
1830
+ declare function literal<S extends Primitives>(value: S): ILiteralType<S>;
1825
1831
  /**
1826
1832
  * Returns if a given value represents a literal type.
1827
1833
  *
1834
+ * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
1835
+ * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
1836
+ * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
1837
+ * to compile. Guards with a distinct narrowing target (`isArrayType`,
1838
+ * `isMapType`, `isModelType`) keep their predicate.
1839
+ *
1828
1840
  * @param type
1829
1841
  * @returns
1830
1842
  */
1831
- declare function isLiteralType<IT extends ISimpleType<any>>(type: IT): type is IT;
1843
+ declare function isLiteralType(type: IAnyType): boolean;
1832
1844
 
1833
1845
  declare function refinement<IT extends IAnyType>(name: string, type: IT, predicate: (snapshot: IT["CreationType"]) => boolean, message?: string | ((v: IT["CreationType"]) => string)): IT;
1834
1846
  declare function refinement<IT extends IAnyType>(type: IT, predicate: (snapshot: IT["CreationType"]) => boolean, message?: string | ((v: IT["CreationType"]) => string)): IT;
1835
1847
  /**
1836
1848
  * Returns if a given value is a refinement type.
1837
1849
  *
1850
+ * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
1851
+ * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
1852
+ * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
1853
+ * to compile. Guards with a distinct narrowing target (`isArrayType`,
1854
+ * `isMapType`, `isModelType`) keep their predicate.
1855
+ *
1838
1856
  * @param type
1839
1857
  * @returns
1840
1858
  */
1841
- declare function isRefinementType<IT extends IAnyType>(type: IT): type is IT;
1859
+ declare function isRefinementType(type: IAnyType): boolean;
1842
1860
 
1843
1861
  /** @hidden */
1844
1862
  type UnionStringArray<T extends readonly string[]> = T[number];
@@ -1858,47 +1876,36 @@ type _CustomCSProcessor<T> = Exclude<T, _NotCustomized> extends never ? _NotCust
1858
1876
  /** @hidden */
1859
1877
  interface ITypeUnion<C, S, T> extends IType<_CustomCSProcessor<C>, _CustomCSProcessor<S>, T> {
1860
1878
  }
1861
- declare function union<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB>(A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB>>;
1862
- declare function union<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB>(options: UnionOptions, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB>>;
1863
- declare function union<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>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC>>;
1864
- declare function union<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC>(options: UnionOptions, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC>>;
1865
- declare function union<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>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC> | ModelCreationType2<PD, FCD>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC> | ModelSnapshotType2<PD, FSD>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC> | ModelInstanceType<PD, OD>>;
1866
- declare function union<PA extends ModelProperties, OA, FCA, FSA, PB extends ModelProperties, OB, FCB, FSB, PC extends ModelProperties, OC, FCC, FSC, PD extends ModelProperties, OD, FCD, FSD>(options: UnionOptions, A: IModelType<PA, OA, FCA, FSA>, B: IModelType<PB, OB, FCB, FSB>, C: IModelType<PC, OC, FCC, FSC>, D: IModelType<PD, OD, FCD, FSD>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC> | ModelCreationType2<PD, FCD>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC> | ModelSnapshotType2<PD, FSD>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC> | ModelInstanceType<PD, OD>>;
1867
- declare function union<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>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC> | ModelCreationType2<PD, FCD> | ModelCreationType2<PE, FCE>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC> | ModelSnapshotType2<PD, FSD> | ModelSnapshotType2<PE, FSE>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC> | ModelInstanceType<PD, OD> | ModelInstanceType<PE, OE>>;
1868
- declare function union<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>(options: UnionOptions, 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>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC> | ModelCreationType2<PD, FCD> | ModelCreationType2<PE, FCE>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC> | ModelSnapshotType2<PD, FSD> | ModelSnapshotType2<PE, FSE>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC> | ModelInstanceType<PD, OD> | ModelInstanceType<PE, OE>>;
1869
- declare function union<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>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC> | ModelCreationType2<PD, FCD> | ModelCreationType2<PE, FCE> | ModelCreationType2<PF, FCF>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC> | ModelSnapshotType2<PD, FSD> | ModelSnapshotType2<PE, FSE> | ModelSnapshotType2<PF, FSF>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC> | ModelInstanceType<PD, OD> | ModelInstanceType<PE, OE> | ModelInstanceType<PF, OF>>;
1870
- declare function union<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>(options: UnionOptions, 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>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC> | ModelCreationType2<PD, FCD> | ModelCreationType2<PE, FCE> | ModelCreationType2<PF, FCF>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC> | ModelSnapshotType2<PD, FSD> | ModelSnapshotType2<PE, FSE> | ModelSnapshotType2<PF, FSF>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC> | ModelInstanceType<PD, OD> | ModelInstanceType<PE, OE> | ModelInstanceType<PF, OF>>;
1871
- declare function union<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>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC> | ModelCreationType2<PD, FCD> | ModelCreationType2<PE, FCE> | ModelCreationType2<PF, FCF> | ModelCreationType2<PG, FCG>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC> | ModelSnapshotType2<PD, FSD> | ModelSnapshotType2<PE, FSE> | ModelSnapshotType2<PF, FSF> | ModelSnapshotType2<PG, FSG>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC> | ModelInstanceType<PD, OD> | ModelInstanceType<PE, OE> | ModelInstanceType<PF, OF> | ModelInstanceType<PG, OG>>;
1872
- declare function union<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>(options: UnionOptions, 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>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC> | ModelCreationType2<PD, FCD> | ModelCreationType2<PE, FCE> | ModelCreationType2<PF, FCF> | ModelCreationType2<PG, FCG>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC> | ModelSnapshotType2<PD, FSD> | ModelSnapshotType2<PE, FSE> | ModelSnapshotType2<PF, FSF> | ModelSnapshotType2<PG, FSG>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC> | ModelInstanceType<PD, OD> | ModelInstanceType<PE, OE> | ModelInstanceType<PF, OF> | ModelInstanceType<PG, OG>>;
1873
- declare function union<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>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC> | ModelCreationType2<PD, FCD> | ModelCreationType2<PE, FCE> | ModelCreationType2<PF, FCF> | ModelCreationType2<PG, FCG> | ModelCreationType2<PH, FCH>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC> | ModelSnapshotType2<PD, FSD> | ModelSnapshotType2<PE, FSE> | ModelSnapshotType2<PF, FSF> | ModelSnapshotType2<PG, FSG> | ModelSnapshotType2<PH, FSH>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC> | ModelInstanceType<PD, OD> | ModelInstanceType<PE, OE> | ModelInstanceType<PF, OF> | ModelInstanceType<PG, OG> | ModelInstanceType<PH, OH>>;
1874
- declare function union<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>(options: UnionOptions, 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>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC> | ModelCreationType2<PD, FCD> | ModelCreationType2<PE, FCE> | ModelCreationType2<PF, FCF> | ModelCreationType2<PG, FCG> | ModelCreationType2<PH, FCH>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC> | ModelSnapshotType2<PD, FSD> | ModelSnapshotType2<PE, FSE> | ModelSnapshotType2<PF, FSF> | ModelSnapshotType2<PG, FSG> | ModelSnapshotType2<PH, FSH>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC> | ModelInstanceType<PD, OD> | ModelInstanceType<PE, OE> | ModelInstanceType<PF, OF> | ModelInstanceType<PG, OG> | ModelInstanceType<PH, OH>>;
1875
- declare function union<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>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC> | ModelCreationType2<PD, FCD> | ModelCreationType2<PE, FCE> | ModelCreationType2<PF, FCF> | ModelCreationType2<PG, FCG> | ModelCreationType2<PH, FCH> | ModelCreationType2<PI, FCI>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC> | ModelSnapshotType2<PD, FSD> | ModelSnapshotType2<PE, FSE> | ModelSnapshotType2<PF, FSF> | ModelSnapshotType2<PG, FSG> | ModelSnapshotType2<PH, FSH> | ModelSnapshotType2<PI, FSI>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC> | ModelInstanceType<PD, OD> | ModelInstanceType<PE, OE> | ModelInstanceType<PF, OF> | ModelInstanceType<PG, OG> | ModelInstanceType<PH, OH> | ModelInstanceType<PI, OI>>;
1876
- declare function union<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>(options: UnionOptions, 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>): ITypeUnion<ModelCreationType2<PA, FCA> | ModelCreationType2<PB, FCB> | ModelCreationType2<PC, FCC> | ModelCreationType2<PD, FCD> | ModelCreationType2<PE, FCE> | ModelCreationType2<PF, FCF> | ModelCreationType2<PG, FCG> | ModelCreationType2<PH, FCH> | ModelCreationType2<PI, FCI>, ModelSnapshotType2<PA, FSA> | ModelSnapshotType2<PB, FSB> | ModelSnapshotType2<PC, FSC> | ModelSnapshotType2<PD, FSD> | ModelSnapshotType2<PE, FSE> | ModelSnapshotType2<PF, FSF> | ModelSnapshotType2<PG, FSG> | ModelSnapshotType2<PH, FSH> | ModelSnapshotType2<PI, FSI>, ModelInstanceType<PA, OA> | ModelInstanceType<PB, OB> | ModelInstanceType<PC, OC> | ModelInstanceType<PD, OD> | ModelInstanceType<PE, OE> | ModelInstanceType<PF, OF> | ModelInstanceType<PG, OG> | ModelInstanceType<PH, OH> | ModelInstanceType<PI, OI>>;
1879
+ /** @hidden */
1880
+ type _UnionMembersCreationType<Types extends readonly IAnyType[]> = {
1881
+ [K in keyof Types]: Types[K]["CreationType"];
1882
+ }[number];
1883
+ /** @hidden */
1884
+ type _UnionMembersSnapshotType<Types extends readonly IAnyType[]> = {
1885
+ [K in keyof Types]: Types[K]["SnapshotType"];
1886
+ }[number];
1887
+ /** @hidden */
1888
+ type _UnionMembersTypeWithoutSTN<Types extends readonly IAnyType[]> = {
1889
+ [K in keyof Types]: Types[K]["TypeWithoutSTN"];
1890
+ }[number];
1877
1891
  declare function union<CA, SA, TA, CB, SB, TB>(A: IType<CA, SA, TA>, B: IType<CB, SB, TB>): ITypeUnion<CA | CB, SA | SB, TA | TB>;
1878
- declare function union<CA, SA, TA, CB, SB, TB>(options: UnionOptions, A: IType<CA, SA, TA>, B: IType<CB, SB, TB>): ITypeUnion<CA | CB, SA | SB, TA | TB>;
1879
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC>(A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>): ITypeUnion<CA | CB | CC, SA | SB | SC, TA | TB | TC>;
1880
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC>(options: UnionOptions, A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>): ITypeUnion<CA | CB | CC, SA | SB | SC, TA | TB | TC>;
1881
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD>(A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>, D: IType<CD, SD, TD>): ITypeUnion<CA | CB | CC | CD, SA | SB | SC | SD, TA | TB | TC | TD>;
1882
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD>(options: UnionOptions, A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>, D: IType<CD, SD, TD>): ITypeUnion<CA | CB | CC | CD, SA | SB | SC | SD, TA | TB | TC | TD>;
1883
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE>(A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>, D: IType<CD, SD, TD>, E: IType<CE, SE, TE>): ITypeUnion<CA | CB | CC | CD | CE, SA | SB | SC | SD | SE, TA | TB | TC | TD | TE>;
1884
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE>(options: UnionOptions, A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>, D: IType<CD, SD, TD>, E: IType<CE, SE, TE>): ITypeUnion<CA | CB | CC | CD | CE, SA | SB | SC | SD | SE, TA | TB | TC | TD | TE>;
1885
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF>(A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>, D: IType<CD, SD, TD>, E: IType<CE, SE, TE>, F: IType<CF, SF, TF>): ITypeUnion<CA | CB | CC | CD | CE | CF, SA | SB | SC | SD | SE | SF, TA | TB | TC | TD | TE | TF>;
1886
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF>(options: UnionOptions, A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>, D: IType<CD, SD, TD>, E: IType<CE, SE, TE>, F: IType<CF, SF, TF>): ITypeUnion<CA | CB | CC | CD | CE | CF, SA | SB | SC | SD | SE | SF, TA | TB | TC | TD | TE | TF>;
1887
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF, CG, SG, TG>(A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>, D: IType<CD, SD, TD>, E: IType<CE, SE, TE>, F: IType<CF, SF, TF>, G: IType<CG, SG, TG>): ITypeUnion<CA | CB | CC | CD | CE | CF | CG, SA | SB | SC | SD | SE | SF | SG, TA | TB | TC | TD | TE | TF | TG>;
1888
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF, CG, SG, TG>(options: UnionOptions, A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>, D: IType<CD, SD, TD>, E: IType<CE, SE, TE>, F: IType<CF, SF, TF>, G: IType<CG, SG, TG>): ITypeUnion<CA | CB | CC | CD | CE | CF | CG, SA | SB | SC | SD | SE | SF | SG, TA | TB | TC | TD | TE | TF | TG>;
1889
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF, CG, SG, TG, CH, SH, TH>(A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>, D: IType<CD, SD, TD>, E: IType<CE, SE, TE>, F: IType<CF, SF, TF>, G: IType<CG, SG, TG>, H: IType<CH, SH, TH>): ITypeUnion<CA | CB | CC | CD | CE | CF | CG | CH, SA | SB | SC | SD | SE | SF | SG | SH, TA | TB | TC | TD | TE | TF | TG | TH>;
1890
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF, CG, SG, TG, CH, SH, TH>(options: UnionOptions, A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>, D: IType<CD, SD, TD>, E: IType<CE, SE, TE>, F: IType<CF, SF, TF>, G: IType<CG, SG, TG>, H: IType<CH, SH, TH>): ITypeUnion<CA | CB | CC | CD | CE | CF | CG | CH, SA | SB | SC | SD | SE | SF | SG | SH, TA | TB | TC | TD | TE | TF | TG | TH>;
1891
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF, CG, SG, TG, CH, SH, TH, CI, SI, TI>(A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>, D: IType<CD, SD, TD>, E: IType<CE, SE, TE>, F: IType<CF, SF, TF>, G: IType<CG, SG, TG>, H: IType<CH, SH, TH>, I: IType<CI, SI, TI>): ITypeUnion<CA | CB | CC | CD | CE | CF | CG | CH | CI, SA | SB | SC | SD | SE | SF | SG | SH | SI, TA | TB | TC | TD | TE | TF | TG | TH | TI>;
1892
- declare function union<CA, SA, TA, CB, SB, TB, CC, SC, TC, CD, SD, TD, CE, SE, TE, CF, SF, TF, CG, SG, TG, CH, SH, TH, CI, SI, TI>(options: UnionOptions, A: IType<CA, SA, TA>, B: IType<CB, SB, TB>, C: IType<CC, SC, TC>, D: IType<CD, SD, TD>, E: IType<CE, SE, TE>, F: IType<CF, SF, TF>, G: IType<CG, SG, TG>, H: IType<CH, SH, TH>, I: IType<CI, SI, TI>): ITypeUnion<CA | CB | CC | CD | CE | CF | CG | CH | CI, SA | SB | SC | SD | SE | SF | SG | SH | SI, TA | TB | TC | TD | TE | TF | TG | TH | TI>;
1892
+ declare function union<Types extends [IAnyType, ...IAnyType[]]>(...types: Types): ITypeUnion<_UnionMembersCreationType<Types>, _UnionMembersSnapshotType<Types>, _UnionMembersTypeWithoutSTN<Types>>;
1893
+ declare function union<Types extends [IAnyType, ...IAnyType[]]>(options: UnionOptions, ...types: Types): ITypeUnion<_UnionMembersCreationType<Types>, _UnionMembersSnapshotType<Types>, _UnionMembersTypeWithoutSTN<Types>>;
1893
1894
  declare function union(...types: IAnyType[]): IAnyType;
1894
1895
  declare function union(dispatchOrType: UnionOptions | IAnyType, ...otherTypes: IAnyType[]): IAnyType;
1895
1896
  /**
1896
1897
  * Returns if a given value represents a union type.
1897
1898
  *
1899
+ * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
1900
+ * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
1901
+ * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
1902
+ * to compile. Guards with a distinct narrowing target (`isArrayType`,
1903
+ * `isMapType`, `isModelType`) keep their predicate.
1904
+ *
1898
1905
  * @param type
1899
1906
  * @returns
1900
1907
  */
1901
- declare function isUnionType<IT extends IAnyType>(type: IT): type is IT;
1908
+ declare function isUnionType(type: IAnyType): boolean;
1902
1909
  /**
1903
1910
  * Returns the member types of a union.
1904
1911
  *
@@ -1920,7 +1927,7 @@ type ValidOptionalValues = [ValidOptionalValue, ...ValidOptionalValue[]];
1920
1927
  /** @hidden */
1921
1928
  type OptionalDefaultValueOrFunction<IT extends IAnyType> = IT["CreationType"] | IT["SnapshotType"] | (() => ExtractCSTWithSTN<IT>);
1922
1929
  /** @hidden */
1923
- interface IOptionalIType<IT extends IAnyType, OptionalVals extends ValidOptionalValues> extends IType<IT["CreationType"] | OptionalVals[number], IT["SnapshotType"], IT["TypeWithoutSTN"]> {
1930
+ interface IOptionalIType<IT extends IAnyType = IAnyType, OptionalVals extends ValidOptionalValues = ValidOptionalValues> extends IType<IT["CreationType"] | OptionalVals[number], IT["SnapshotType"], IT["TypeWithoutSTN"]> {
1924
1931
  getDefaultInstanceOrSnapshot(): IT["CreationType"] | IT["SnapshotType"];
1925
1932
  }
1926
1933
  declare function optional<IT extends IAnyType>(type: IT, defaultValueOrFunction: OptionalDefaultValueOrFunction<IT>): IOptionalIType<IT, [undefined]>;
@@ -1928,11 +1935,16 @@ declare function optional<IT extends IAnyType, OptionalVals extends ValidOptiona
1928
1935
  /**
1929
1936
  * Returns if a value represents an optional type.
1930
1937
  *
1931
- * @template IT
1938
+ * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
1939
+ * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
1940
+ * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
1941
+ * to compile. Guards with a distinct narrowing target (`isArrayType`,
1942
+ * `isMapType`, `isModelType`) keep their predicate.
1943
+ *
1932
1944
  * @param type
1933
1945
  * @returns
1934
1946
  */
1935
- declare function isOptionalType<IT extends IAnyType>(type: IT): type is IT;
1947
+ declare function isOptionalType(type: IAnyType): boolean;
1936
1948
  /**
1937
1949
  * `types.stripDefault` - Like `types.optional`, but the property is omitted from
1938
1950
  * a parent model's snapshot entirely when its value equals the default (instead
@@ -1976,10 +1988,16 @@ declare function late<T extends IAnyType>(name: string, type: () => T): T;
1976
1988
  /**
1977
1989
  * Returns if a given value represents a late type.
1978
1990
  *
1991
+ * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
1992
+ * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
1993
+ * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
1994
+ * to compile. Guards with a distinct narrowing target (`isArrayType`,
1995
+ * `isMapType`, `isModelType`) keep their predicate.
1996
+ *
1979
1997
  * @param type
1980
1998
  * @returns
1981
1999
  */
1982
- declare function isLateType<IT extends IAnyType>(type: IT): type is IT;
2000
+ declare function isLateType(type: IAnyType): boolean;
1983
2001
 
1984
2002
  interface LazyOptions<T extends IType<any, any, any>, U> {
1985
2003
  loadType: () => Promise<T>;
@@ -1993,10 +2011,16 @@ declare function frozen<T = any>(): IType<T, T, T>;
1993
2011
  /**
1994
2012
  * Returns if a given value represents a frozen type.
1995
2013
  *
2014
+ * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
2015
+ * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
2016
+ * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
2017
+ * to compile. Guards with a distinct narrowing target (`isArrayType`,
2018
+ * `isMapType`, `isModelType`) keep their predicate.
2019
+ *
1996
2020
  * @param type
1997
2021
  * @returns
1998
2022
  */
1999
- declare function isFrozenType<IT extends IType<T | any, T, T>, T = any>(type: IT): type is IT;
2023
+ declare function isFrozenType(type: IAnyType): boolean;
2000
2024
 
2001
2025
  type OnReferenceInvalidatedEvent<STN extends IAnyStateTreeNode> = {
2002
2026
  parent: IAnyStateTreeNode;
@@ -2028,10 +2052,16 @@ declare function reference<IT extends IAnyComplexType>(subType: IT, options?: Re
2028
2052
  /**
2029
2053
  * Returns if a given value represents a reference type.
2030
2054
  *
2055
+ * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
2056
+ * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
2057
+ * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
2058
+ * to compile. Guards with a distinct narrowing target (`isArrayType`,
2059
+ * `isMapType`, `isModelType`) keep their predicate.
2060
+ *
2031
2061
  * @param type
2032
2062
  * @returns
2033
2063
  */
2034
- declare function isReferenceType<IT extends IReferenceType<any>>(type: IT): type is IT;
2064
+ declare function isReferenceType(type: IAnyType): boolean;
2035
2065
  declare function safeReference<IT extends IAnyComplexType>(subType: IT, options: (ReferenceOptionsGetSet<IT> | object) & {
2036
2066
  acceptsUndefined: false;
2037
2067
  onInvalidated?: OnReferenceInvalidated<ReferenceT<IT>>;
@@ -2041,45 +2071,19 @@ declare function safeReference<IT extends IAnyComplexType>(subType: IT, options?
2041
2071
  onInvalidated?: OnReferenceInvalidated<ReferenceT<IT>>;
2042
2072
  }): IMaybe<IReferenceType<IT>>;
2043
2073
 
2044
- /**
2045
- * `types.identifier` - Identifiers are used to make references, lifecycle events and reconciling works.
2046
- * Inside a state tree, for each type can exist only one instance for each given identifier.
2047
- * For example there couldn't be 2 instances of user with id 1. If you need more, consider using references.
2048
- * Identifier can be used only as type property of a model.
2049
- * This type accepts as parameter the value type of the identifier field that can be either string or number.
2050
- *
2051
- * Example:
2052
- * ```ts
2053
- * const Todo = types.model("Todo", {
2054
- * id: types.identifier,
2055
- * title: types.string
2056
- * })
2057
- * ```
2058
- *
2059
- * @returns
2060
- */
2061
- declare const identifier: ISimpleType<string>;
2062
- /**
2063
- * `types.identifierNumber` - Similar to `types.identifier`. This one will serialize from / to a number when applying snapshots
2064
- *
2065
- * Example:
2066
- * ```ts
2067
- * const Todo = types.model("Todo", {
2068
- * id: types.identifierNumber,
2069
- * title: types.string
2070
- * })
2071
- * ```
2072
- *
2073
- * @returns
2074
- */
2075
- declare const identifierNumber: ISimpleType<number>;
2076
2074
  /**
2077
2075
  * Returns if a given value represents an identifier type.
2078
2076
  *
2077
+ * Returns a plain `boolean`, not a `type is IT` predicate: with the parameter
2078
+ * typed as `IT`, narrowing to `IT` was a no-op in the positive branch while
2079
+ * collapsing the negative one to `never`, so `if (!isX(t)) { t.name }` failed
2080
+ * to compile. Guards with a distinct narrowing target (`isArrayType`,
2081
+ * `isMapType`, `isModelType`) keep their predicate.
2082
+ *
2079
2083
  * @param type
2080
2084
  * @returns
2081
2085
  */
2082
- declare function isIdentifierType<IT extends typeof identifier | typeof identifierNumber>(type: IT): type is IT;
2086
+ declare function isIdentifierType(type: IAnyType): boolean;
2083
2087
  /**
2084
2088
  * Valid types for identifiers.
2085
2089
  */
@@ -2161,7 +2165,7 @@ interface IResilientType<IT extends IAnyType, FT extends IAnyType> extends IType
2161
2165
  * @param createFallbackSnapshot Callback that produces a fallback snapshot from the error and original snapshot.
2162
2166
  * @returns A resilient type.
2163
2167
  */
2164
- declare function resilient<IT extends IAnyType, FT extends IAnyType>(type: IT, fallbackType: FT, createFallbackSnapshot: (error: unknown, snapshot: any) => FT["CreationType"]): IResilientType<IT, FT>;
2168
+ declare function resilient<IT extends IAnyType, FT extends IAnyType>(type: IT, fallbackType: FT, createFallbackSnapshot: (error: unknown, snapshot: unknown) => FT["CreationType"]): IResilientType<IT, FT>;
2165
2169
 
2166
2170
  declare const types: {
2167
2171
  enumeration: typeof enumeration;
@@ -2197,5 +2201,5 @@ declare const types: {
2197
2201
  resilient: typeof resilient;
2198
2202
  };
2199
2203
 
2200
- export { addDisposer, addMiddleware, applyAction, applyPatch, applySnapshot, 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 };
2201
- 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 };
2204
+ 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 };
2205
+ 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 };