@expressive/mvc 1.0.0-beta.40 → 1.0.0-beta.43

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/lib/index.d.ts CHANGED
@@ -442,7 +442,8 @@ declare class MVC extends Model {
442
442
  *
443
443
  * @param callback - Run after creation of instance.
444
444
  */
445
- static new<T extends Class>(this: T, callback?: (instance: InstanceOf<T>) => void): InstanceOf<T>;
445
+ static new<T extends Class, I extends InstanceOf<T>>(this: T, callback?: (instance: I) => void): I;
446
+ static new<T extends Class, I extends InstanceOf<T>>(this: T, apply: Model.Compat<I>): I;
446
447
  static use<T extends Class, I extends InstanceOf<T>>(this: T, watch: Model.Field<I>[], callback?: (instance: I) => void): I;
447
448
  static use<T extends Class, I extends InstanceOf<T>>(this: T, callback?: (instance: I) => void): I;
448
449
  static use<T extends Class, I extends InstanceOf<T>>(this: T, apply: Model.Compat<I>, keys?: Model.Event<I>[]): I;
@@ -533,7 +534,22 @@ declare class Global extends MVC {
533
534
  * If instance does not already exist, one will be created.
534
535
  */
535
536
  static set<T extends typeof Global>(this: T, updates: Partial<InstanceOf<T>>): PromiseLike<false | readonly Model.Event<Global, Model>[]>;
536
- static get(arg?: boolean | string): any;
537
+ /**
538
+ * **React Hook** - Fetch most instance of this controller from context, if it exists.
539
+ *
540
+ * @param required - If false, may return undefined.
541
+ */
542
+ static get<T extends Class>(this: T, required?: true): InstanceOf<T>;
543
+ /**
544
+ * **React Hook** - Fetch most instance of this controller from context.
545
+ *
546
+ * @param required - Unless false, will throw where instance cannot be found.
547
+ */
548
+ static get<T extends Class>(this: T, required: boolean): InstanceOf<T> | undefined;
549
+ /**
550
+ * **React Hook** - Fetch specific value from instance of this controller in context.
551
+ */
552
+ static get<T extends Class, K extends Model.Field<InstanceOf<T>>>(this: T, key: K): InstanceOf<T>[K];
537
553
  /** Destroy current instance of Global, if it exists. */
538
554
  static reset(): void;
539
555
  destroy(): void;