@vicin/sigil 2.0.1 → 2.0.2

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