@madronejs/core 1.1.0 → 1.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@madronejs/core",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Object composition and reactivity framework.",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -21,8 +21,7 @@
21
21
  * }
22
22
  * ```
23
23
  */
24
- import { DecoratorDescriptorType } from './interfaces';
25
- type Constructor = new (...args: unknown[]) => object;
24
+ import { DecoratorDescriptorType, Constructor } from './interfaces';
26
25
  /**
27
26
  * Class decorator that mixes in methods from other classes.
28
27
  *
@@ -135,5 +134,4 @@ export declare namespace reactive {
135
134
  var shallow: (target: object, key: string) => void;
136
135
  var configure: (descriptorOverrides: DecoratorDescriptorType) => (target: object, key: string) => void;
137
136
  }
138
- export {};
139
137
  //# sourceMappingURL=decorate.d.ts.map
@@ -120,6 +120,19 @@ export interface IntegrationOptions {
120
120
  * };
121
121
  * ```
122
122
  */
123
+ /**
124
+ * A class constructor type that produces instances of type T.
125
+ *
126
+ * Unlike a simple `new (...args) => T` signature, this type also
127
+ * captures that constructors have a `prototype` property, which is
128
+ * important for mixin and class composition utilities.
129
+ *
130
+ * @typeParam T - The instance type that the constructor creates
131
+ */
132
+ export type Constructor<T = object> = {
133
+ new (...args: unknown[]): T;
134
+ prototype: T;
135
+ };
123
136
  export interface Integration {
124
137
  /**
125
138
  * Defines a reactive property on an object.
package/types/util.d.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  * These utilities support Madrone's composition-based architecture,
7
7
  * allowing you to build complex objects from simpler pieces.
8
8
  */
9
+ import type { Constructor } from './interfaces';
9
10
  type OptionalPropertyNames<T> = {
10
11
  [K in keyof T]-?: object extends {
11
12
  [P in K]: T[K];
@@ -68,7 +69,6 @@ export type Spread<A extends readonly unknown[]> = A extends [infer L, ...infer
68
69
  * ```
69
70
  */
70
71
  export declare function merge<A extends ObjectOrFactory[]>(...types: [...A]): Spread<A>;
71
- type Constructor = new (...args: unknown[]) => object;
72
72
  /**
73
73
  * Applies mixin classes to a base class by merging their prototypes.
74
74
  *