tstyche 3.3.0 → 3.3.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/build/tstyche.js +17 -10
- package/package.json +1 -1
package/build/tstyche.js
CHANGED
|
@@ -3474,15 +3474,13 @@ class MatchWorker {
|
|
|
3474
3474
|
return this.#checkIsRelatedTo(sourceNode, targetNode, relation);
|
|
3475
3475
|
}
|
|
3476
3476
|
#checkIsRelatedTo(sourceNode, targetNode, relation) {
|
|
3477
|
-
const sourceType = this.
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
}
|
|
3485
|
-
return result;
|
|
3477
|
+
const sourceType = relation === this.#typeChecker.relation.identity
|
|
3478
|
+
? this.#trySimplifyType(this.getType(sourceNode))
|
|
3479
|
+
: this.getType(sourceNode);
|
|
3480
|
+
const targetType = relation === this.#typeChecker.relation.identity
|
|
3481
|
+
? this.#trySimplifyType(this.getType(targetNode))
|
|
3482
|
+
: this.getType(targetNode);
|
|
3483
|
+
return this.#typeChecker.isTypeRelatedTo(sourceType, targetType, relation);
|
|
3486
3484
|
}
|
|
3487
3485
|
extendsObjectType(type) {
|
|
3488
3486
|
const nonPrimitiveType = { flags: this.#compiler.TypeFlags.NonPrimitive };
|
|
@@ -3550,6 +3548,15 @@ class MatchWorker {
|
|
|
3550
3548
|
}
|
|
3551
3549
|
return DiagnosticOrigin.fromNode(enclosingNode, this.assertion);
|
|
3552
3550
|
}
|
|
3551
|
+
#trySimplifyType(type) {
|
|
3552
|
+
if (type.isIntersection() || type.isUnion()) {
|
|
3553
|
+
const candidateType = type.types[0];
|
|
3554
|
+
if (type.types.every((type) => this.#typeChecker.isTypeRelatedTo(type, candidateType, this.#typeChecker.relation.identity))) {
|
|
3555
|
+
return candidateType;
|
|
3556
|
+
}
|
|
3557
|
+
}
|
|
3558
|
+
return type;
|
|
3559
|
+
}
|
|
3553
3560
|
}
|
|
3554
3561
|
|
|
3555
3562
|
class PrimitiveTypeMatcher {
|
|
@@ -4327,7 +4334,7 @@ class TaskRunner {
|
|
|
4327
4334
|
class Runner {
|
|
4328
4335
|
#eventEmitter = new EventEmitter();
|
|
4329
4336
|
#resolvedConfig;
|
|
4330
|
-
static version = "3.3.
|
|
4337
|
+
static version = "3.3.1";
|
|
4331
4338
|
constructor(resolvedConfig) {
|
|
4332
4339
|
this.#resolvedConfig = resolvedConfig;
|
|
4333
4340
|
}
|