33 * @export
44 * @abstract
55 * @class Value
6- * @template Type
6+ * @template Type The type of the privately stored `#value`.
77 */
8+
89export abstract class Value < Type > {
910 /**
1011 * @description Returns the `string` tag representation of the `Value` class when used in `Object.prototype.toString.call(instance)`.
12+ * The `tag` getter returns the actual class name defined with the `Symbol.toStringTag()` of the child class.
1113 * @public
1214 * @readonly
1315 * @type {string }
@@ -16,6 +18,16 @@ export abstract class Value<Type> {
1618 return 'Value' ;
1719 }
1820
21+ /**
22+ * @description Returns the string tag of the current instance defined by the `Symbol.toStringTag`.
23+ * @public
24+ * @returns {string | undefined } The extracted class name, such as `'Value'`, or `undefined` if extraction fails.
25+ */
26+ public get tag ( ) : string | undefined {
27+ const tag = Object . prototype . toString . call ( this ) . slice ( 8 , - 1 ) ;
28+ return tag !== 'Object' ? tag : undefined ;
29+ }
30+
1931 /**
2032 * @description Returns the privately stored value of generic type variable `Type`.
2133 * @public
@@ -26,7 +38,6 @@ export abstract class Value<Type> {
2638 return this . #value;
2739 }
2840
29-
3041 /**
3142 * @description Privately stored value of generic type variable `Type`.
3243 * @type {Type }
@@ -42,16 +53,6 @@ export abstract class Value<Type> {
4253 this . #value = value ;
4354 }
4455
45- /**
46- * @description Extracts the string tag of the current instance defined by the `Symbol.toStringTag`.
47- * @public
48- * @returns {string | undefined } The extracted class name, such as `'Value'`, or `undefined` if extraction fails.
49- */
50- public get tag ( ) : string | undefined {
51- const tag = Object . prototype . toString . call ( this ) . slice ( 8 , - 1 ) ;
52- return tag !== 'Object' ? tag : undefined ;
53- }
54-
5556 /**
5657 * @description Sets the value of generic type variable `Type`.
5758 * @protected
0 commit comments