@vicin/sigil 2.0.1 → 2.0.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [2.0.3] - 2026-02-21
6
+
7
+ - Patched types
8
+
9
+ ## [2.0.2] - 2026-02-21
10
+
11
+ ### Changed
12
+
13
+ - Patched types
14
+
5
15
  ## [2.0.1] - 2026-02-21
6
16
 
7
17
  ### Removed
package/dist/index.d.mts CHANGED
@@ -58,7 +58,7 @@ interface ISigilStatic<L extends string = string, P extends Function = never> {
58
58
  * @param other - The object to test.
59
59
  * @returns A type guard asserting `other` is an instance of the constructor.
60
60
  */
61
- isOfType<T extends ISigil>(this: T, other: unknown): other is InstanceType<T>;
61
+ isOfType<T extends ISigilStatic>(this: T, other: unknown): other is GetInstance<T>;
62
62
  /**
63
63
  * Strict lineage comparison: verifies that the calling constructor's type
64
64
  * lineage (by label) matches the `other`'s lineage element-by-element.
@@ -71,7 +71,7 @@ interface ISigilStatic<L extends string = string, P extends Function = never> {
71
71
  * @param other - The object to test.
72
72
  * @returns A type guard asserting `other` is an instance whose lineage matches exactly.
73
73
  */
74
- isOfTypeStrict<T extends ISigil>(this: T, other: unknown): other is InstanceType<T>;
74
+ isOfTypeStrict<T extends ISigilStatic>(this: T, other: unknown): other is GetInstance<T>;
75
75
  }
76
76
  /**
77
77
  * Instance-side interface describing properties present on sigil instances.
@@ -93,12 +93,37 @@ interface ISigilInstance<L extends string = string, P extends Function = never>
93
93
  } & SigilBrandOf<P>>;
94
94
  /** Returns human-readable sigil label of the class constructor. */
95
95
  getSigilLabel(): string;
96
- /** Returns runtime sigil type label of the class constructor. */
97
- getSigilType(): string;
98
96
  /** Returns copy of sigil type label lineage of the class constructor. */
99
97
  getSigilLabelLineage(): readonly string[];
100
98
  /** Returns copy of sigil type label set of the class constructor. */
101
99
  getSigilLabelSet(): Readonly<Set<string>>;
100
+ /**
101
+ * Check whether `other` is (or inherits from) the type represented by the
102
+ * calling constructor. Uses the other instance's `SigilLabelSet` to check
103
+ * membership. Works in O(1) and is reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.
104
+ *
105
+ * This replaces `instanceof` so that checks remain valid across bundles/realms
106
+ * and when subclassing.
107
+ *
108
+ * @typeParam T - The specific sigil constructor (`this`).
109
+ * @param this - The constructor performing the type check.
110
+ * @param other - The object to test.
111
+ * @returns A type guard asserting `other` is an instance of the constructor.
112
+ */
113
+ isOfType<T extends ISigilInstance>(this: T, other: unknown): other is GetInstance<T>;
114
+ /**
115
+ * Strict lineage comparison: verifies that the calling constructor's type
116
+ * lineage (by label) matches the `other`'s lineage element-by-element.
117
+ *
118
+ * Works in O(n) where `n` is the lineage length and is useful when order
119
+ * and exact ancestry must be confirmed. reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.
120
+ *
121
+ * @typeParam T - The specific sigil constructor (`this`).
122
+ * @param this - The constructor performing the strict check.
123
+ * @param other - The object to test.
124
+ * @returns A type guard asserting `other` is an instance whose lineage matches exactly.
125
+ */
126
+ isOfTypeStrict<T extends ISigilInstance>(this: T, other: unknown): other is GetInstance<T>;
102
127
  }
103
128
  /**
104
129
  * Combined constructor + static interface for a sigil class.
@@ -218,7 +243,7 @@ declare const Sigil: {
218
243
  } & {
219
244
  new (): {};
220
245
  };
221
- type Sigil = InstanceType<typeof Sigil>;
246
+ type Sigil = GetInstance<typeof Sigil>;
222
247
  /**
223
248
  * A sigil variant of the built-in `Error` constructor used by the library
224
249
  * to represent Sigil-specific errors.
@@ -249,7 +274,7 @@ declare const SigilError: {
249
274
  isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
250
275
  isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
251
276
  } & ErrorConstructor;
252
- type SigilError = InstanceType<typeof SigilError>;
277
+ type SigilError = GetInstance<typeof SigilError>;
253
278
 
254
279
  /**
255
280
  * Configuration options for the Sigil library.
@@ -394,7 +419,7 @@ declare function isSigilCtor(ctor: unknown): ctor is ISigil;
394
419
  * @param inst - The instanca to test.
395
420
  * @returns `true` if `obj` is an instance produced by a sigil constructor.
396
421
  */
397
- declare function isSigilInstance(inst: unknown): inst is InstanceType<ISigil>;
422
+ declare function isSigilInstance(inst: unknown): inst is GetInstance<ISigil>;
398
423
  /**
399
424
  * Check whether the provided constructor was marked as a sigil base constructor.
400
425
  *
@@ -412,7 +437,7 @@ declare function isSigilBaseCtor(ctor: Function): ctor is ISigil;
412
437
  * @param inst - The instance to test.
413
438
  * @returns `true` if `inst` is an instance of a sigil base constructor.
414
439
  */
415
- declare function isSigilBaseInstance(inst: unknown): inst is InstanceType<ISigil>;
440
+ declare function isSigilBaseInstance(inst: unknown): inst is GetInstance<ISigil>;
416
441
  /**
417
442
  * Returns whether the constructor has been explicitly decorated with `WithSigil`.
418
443
  *
package/dist/index.d.ts CHANGED
@@ -58,7 +58,7 @@ interface ISigilStatic<L extends string = string, P extends Function = never> {
58
58
  * @param other - The object to test.
59
59
  * @returns A type guard asserting `other` is an instance of the constructor.
60
60
  */
61
- isOfType<T extends ISigil>(this: T, other: unknown): other is InstanceType<T>;
61
+ isOfType<T extends ISigilStatic>(this: T, other: unknown): other is GetInstance<T>;
62
62
  /**
63
63
  * Strict lineage comparison: verifies that the calling constructor's type
64
64
  * lineage (by label) matches the `other`'s lineage element-by-element.
@@ -71,7 +71,7 @@ interface ISigilStatic<L extends string = string, P extends Function = never> {
71
71
  * @param other - The object to test.
72
72
  * @returns A type guard asserting `other` is an instance whose lineage matches exactly.
73
73
  */
74
- isOfTypeStrict<T extends ISigil>(this: T, other: unknown): other is InstanceType<T>;
74
+ isOfTypeStrict<T extends ISigilStatic>(this: T, other: unknown): other is GetInstance<T>;
75
75
  }
76
76
  /**
77
77
  * Instance-side interface describing properties present on sigil instances.
@@ -93,12 +93,37 @@ interface ISigilInstance<L extends string = string, P extends Function = never>
93
93
  } & SigilBrandOf<P>>;
94
94
  /** Returns human-readable sigil label of the class constructor. */
95
95
  getSigilLabel(): string;
96
- /** Returns runtime sigil type label of the class constructor. */
97
- getSigilType(): string;
98
96
  /** Returns copy of sigil type label lineage of the class constructor. */
99
97
  getSigilLabelLineage(): readonly string[];
100
98
  /** Returns copy of sigil type label set of the class constructor. */
101
99
  getSigilLabelSet(): Readonly<Set<string>>;
100
+ /**
101
+ * Check whether `other` is (or inherits from) the type represented by the
102
+ * calling constructor. Uses the other instance's `SigilLabelSet` to check
103
+ * membership. Works in O(1) and is reliable as long as `OPTIONS.skipLabelInheritanceCheck` is `false`.
104
+ *
105
+ * This replaces `instanceof` so that checks remain valid across bundles/realms
106
+ * and when subclassing.
107
+ *
108
+ * @typeParam T - The specific sigil constructor (`this`).
109
+ * @param this - The constructor performing the type check.
110
+ * @param other - The object to test.
111
+ * @returns A type guard asserting `other` is an instance of the constructor.
112
+ */
113
+ isOfType<T extends ISigilInstance>(this: T, other: unknown): other is GetInstance<T>;
114
+ /**
115
+ * Strict lineage comparison: verifies that the calling constructor's type
116
+ * lineage (by label) matches the `other`'s lineage element-by-element.
117
+ *
118
+ * Works in O(n) where `n` is the lineage length and is useful when order
119
+ * and exact ancestry must be confirmed. reliable when `OPTIONS.skipLabelInheritanceCheck` is `false`.
120
+ *
121
+ * @typeParam T - The specific sigil constructor (`this`).
122
+ * @param this - The constructor performing the strict check.
123
+ * @param other - The object to test.
124
+ * @returns A type guard asserting `other` is an instance whose lineage matches exactly.
125
+ */
126
+ isOfTypeStrict<T extends ISigilInstance>(this: T, other: unknown): other is GetInstance<T>;
102
127
  }
103
128
  /**
104
129
  * Combined constructor + static interface for a sigil class.
@@ -218,7 +243,7 @@ declare const Sigil: {
218
243
  } & {
219
244
  new (): {};
220
245
  };
221
- type Sigil = InstanceType<typeof Sigil>;
246
+ type Sigil = GetInstance<typeof Sigil>;
222
247
  /**
223
248
  * A sigil variant of the built-in `Error` constructor used by the library
224
249
  * to represent Sigil-specific errors.
@@ -249,7 +274,7 @@ declare const SigilError: {
249
274
  isOfType<T>(this: T, other: unknown): other is GetInstance<T>;
250
275
  isOfTypeStrict<T>(this: T, other: unknown): other is GetInstance<T>;
251
276
  } & ErrorConstructor;
252
- type SigilError = InstanceType<typeof SigilError>;
277
+ type SigilError = GetInstance<typeof SigilError>;
253
278
 
254
279
  /**
255
280
  * Configuration options for the Sigil library.
@@ -394,7 +419,7 @@ declare function isSigilCtor(ctor: unknown): ctor is ISigil;
394
419
  * @param inst - The instanca to test.
395
420
  * @returns `true` if `obj` is an instance produced by a sigil constructor.
396
421
  */
397
- declare function isSigilInstance(inst: unknown): inst is InstanceType<ISigil>;
422
+ declare function isSigilInstance(inst: unknown): inst is GetInstance<ISigil>;
398
423
  /**
399
424
  * Check whether the provided constructor was marked as a sigil base constructor.
400
425
  *
@@ -412,7 +437,7 @@ declare function isSigilBaseCtor(ctor: Function): ctor is ISigil;
412
437
  * @param inst - The instance to test.
413
438
  * @returns `true` if `inst` is an instance of a sigil base constructor.
414
439
  */
415
- declare function isSigilBaseInstance(inst: unknown): inst is InstanceType<ISigil>;
440
+ declare function isSigilBaseInstance(inst: unknown): inst is GetInstance<ISigil>;
416
441
  /**
417
442
  * Returns whether the constructor has been explicitly decorated with `WithSigil`.
418
443
  *