@xaendar/types 0.3.38 → 0.4.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": "@xaendar/types",
3
- "version": "0.3.38",
3
+ "version": "0.4.1",
4
4
  "description": "A library containing common types shared across packages and consumers",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -4,10 +4,29 @@
4
4
  */
5
5
  export declare type AbstractConstructor<T extends object = object, Statics extends Record<string, unknown> | undefined = undefined> = (abstract new (...args: any[]) => T) & (Statics extends undefined ? object : Statics);
6
6
 
7
- export declare type AccessorDecorator<Class extends Object, Field = unknown, ReturnTypeField = Field> = (value: ClassAccessorDecoratorValue<Field>, context: ClassAccessorDecoratorContext<Class, ReturnTypeField>) => {
8
- get?: () => ReturnTypeField;
9
- set?: (value: ReturnTypeField) => void;
10
- init?: (initialValue: Field) => ReturnTypeField;
7
+ /**
8
+ * Represents a class accessor decorator function.
9
+ *
10
+ * Note: the `context` parameter uses `Field` (not `ReturnTypeField`) because
11
+ * `ClassAccessorDecoratorContext` is tied to the original field type.
12
+ *
13
+ * @template Class - The class that owns the decorated accessor.
14
+ * @template Value - The original type of the accessor's value.
15
+ * @template ActualValue - The type returned/set by the replacement accessor (defaults to `InitialValue`).
16
+ */
17
+ export declare type AccessorDecorator<Class extends object, Value = unknown> = (value: ClassAccessorDecoratorValue<Value>, context: ClassAccessorDecoratorContext<Class, Value>) => {
18
+ /**
19
+ * Replacement getter returning a value of `Value`.
20
+ */
21
+ get?(this: Class): Value;
22
+ /**
23
+ * Replacement setter accepting a value of `Value`.
24
+ */
25
+ set?(this: Class, value: Value): void;
26
+ /**
27
+ * Initializer called with the original field value; should return a `Value`.
28
+ */
29
+ init?(this: Class, initialValue: Value): Value;
11
30
  } | void;
12
31
 
13
32
  /**
@@ -19,9 +38,21 @@ export declare type Beautify<T extends Object> = {
19
38
  [K in keyof T]: T[K];
20
39
  } & {};
21
40
 
41
+ /**
42
+ * Represents the accessor descriptor passed to a class accessor decorator,
43
+ * containing the original `get` and `set` methods of the decorated accessor.
44
+ *
45
+ * @template Field - The type of the accessor's value.
46
+ */
22
47
  export declare type ClassAccessorDecoratorValue<Field = unknown> = {
23
- get?: () => Field;
24
- set: (value: Field) => void;
48
+ /**
49
+ * Returns the current value of the accessor.
50
+ */
51
+ get(this: unknown): Field;
52
+ /**
53
+ * Sets the value of the accessor.
54
+ */
55
+ set(this: unknown, value: Field): void;
25
56
  };
26
57
 
27
58
  declare type ClassDecorator_2<T extends Object, Statics extends {