@jbrowse/mobx-state-tree 5.10.3 → 5.10.4
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
|
@@ -732,9 +732,14 @@ interface IType<C, S, T> {
|
|
|
732
732
|
/**
|
|
733
733
|
* Creates an instance for the type given an snapshot input.
|
|
734
734
|
*
|
|
735
|
+
* The snapshot argument is required when the creation type has at least one
|
|
736
|
+
* required member (`{} extends C` is false) and optional otherwise, so e.g.
|
|
737
|
+
* `types.model({ a: types.string }).create()` is a compile error rather than a
|
|
738
|
+
* runtime throw, while `types.model().create()` stays valid.
|
|
739
|
+
*
|
|
735
740
|
* @returns An instance of that type.
|
|
736
741
|
*/
|
|
737
|
-
create(snapshot?: C, env?: any): this["Type"];
|
|
742
|
+
create(...args: {} extends C ? [snapshot?: C, env?: any] : [snapshot: C, env?: any]): this["Type"];
|
|
738
743
|
/**
|
|
739
744
|
* Checks if a given snapshot / instance is of the given type.
|
|
740
745
|
*
|
|
@@ -1678,9 +1683,9 @@ type ModelCreationType<PC> = MaybeEmpty<{
|
|
|
1678
1683
|
/** @hidden */
|
|
1679
1684
|
type ModelCreationType2<P extends ModelProperties, CustomC> = MaybeEmpty<_CustomOrOther<CustomC, ModelCreationType<ExtractCFromProps<P>>>>;
|
|
1680
1685
|
/** @hidden */
|
|
1681
|
-
type ModelSnapshotType<P extends ModelProperties> =
|
|
1686
|
+
type ModelSnapshotType<P extends ModelProperties> = {
|
|
1682
1687
|
[K in keyof P]: P[K]["SnapshotType"];
|
|
1683
|
-
}
|
|
1688
|
+
};
|
|
1684
1689
|
/** @hidden */
|
|
1685
1690
|
type ModelSnapshotType2<P extends ModelProperties, CustomS> = _CustomOrOther<CustomS, ModelSnapshotType<P>>;
|
|
1686
1691
|
/**
|