@base-framework/base 3.7.4 → 3.7.6

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.
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Type representing a model subclass constructor returned by Model.extend().
3
+ * Use this to annotate parameters that receive a model created via Model.extend().
4
+ */
5
+ export type ModelClass = import("./modules/data/types/model/model.js").ModelClass;
1
6
  import { Ajax } from './modules/ajax/ajax.js';
2
7
  import { Arrays } from './shared/arrays.js';
3
8
  import { Atom } from './modules/atom/atom.js';
@@ -26,6 +26,7 @@ export function createEventMessage(attr: string, event: string): string;
26
26
  * @class
27
27
  */
28
28
  export class BasicData {
29
+ [key: string]: any;
29
30
  /**
30
31
  * This will create a basic data object.
31
32
  *
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Represents a Model subclass constructor returned by {@link Model.extend}.
3
+ *
4
+ * Extends the Model instance interface so all instance methods (`get`, `set`,
5
+ * etc.) are directly visible when this type is used as a parameter annotation,
6
+ * while the construct signature keeps `new VehicleTaxonomyModel()` valid.
7
+ *
8
+ * @typedef {Model & { new(settings?: object): Model, extend(settings?: object): ModelClass, prototype: Model }} ModelClass
9
+ */
1
10
  /**
2
11
  * The Model class extends Data to provide structure
3
12
  * for connecting to a remote service.
@@ -9,11 +18,15 @@ export class Model extends Data {
9
18
  /**
10
19
  * Creates a new subclass of the current Model and returns its constructor.
11
20
  *
21
+ * The returned value can be used as a type annotation for model instances.
22
+ * TypeScript will resolve it to `ModelClass` which extends `Model` directly,
23
+ * so all instance methods (`get`, `set`, etc.) are visible on typed parameters.
24
+ *
12
25
  * @static
13
26
  * @param {object} [settings={}] - Configuration for the extended model.
14
- * @returns {typeof Model} The extended model class (subclass of Model).
27
+ * @returns {ModelClass} The extended model class (subclass of Model).
15
28
  */
16
- static extend(settings?: object): typeof Model;
29
+ static extend(settings?: object): ModelClass;
17
30
  url: any;
18
31
  xhr: any;
19
32
  /**
@@ -26,5 +39,17 @@ export class Model extends Data {
26
39
  protected initialize(): void;
27
40
  service: typeof ModelService;
28
41
  }
42
+ /**
43
+ * Represents a Model subclass constructor returned by {@link Model.extend}.
44
+ *
45
+ * Extends the Model instance interface so all instance methods (`get`, `set`,
46
+ * etc.) are directly visible when this type is used as a parameter annotation,
47
+ * while the construct signature keeps `new VehicleTaxonomyModel()` valid.
48
+ */
49
+ export type ModelClass = Model & {
50
+ new (settings?: object): Model;
51
+ extend(settings?: object): ModelClass;
52
+ prototype: Model;
53
+ };
29
54
  import { Data } from '../deep-data/deep-data.js';
30
55
  import { ModelService } from './model-service.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base-framework/base",
3
- "version": "3.7.4",
3
+ "version": "3.7.6",
4
4
  "description": "This is a javascript framework.",
5
5
  "main": "./dist/base.js",
6
6
  "type": "module",