tstyche 6.0.0-beta.4 → 6.0.0-beta.6
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/dist/tstyche.js +50 -26
- package/package.json +1 -1
package/dist/tstyche.js
CHANGED
|
@@ -4550,8 +4550,9 @@ class ToAcceptProps {
|
|
|
4550
4550
|
}
|
|
4551
4551
|
}
|
|
4552
4552
|
|
|
4553
|
-
function
|
|
4554
|
-
return
|
|
4553
|
+
function containsInstantiableType(target, compiler) {
|
|
4554
|
+
return ("types" in target &&
|
|
4555
|
+
target.types.some((type) => type.flags & compiler.TypeFlags.InstantiableNonPrimitive));
|
|
4555
4556
|
}
|
|
4556
4557
|
function getIndexSignatures(type, compiler, typeChecker) {
|
|
4557
4558
|
if (type.flags & compiler.TypeFlags.Intersection) {
|
|
@@ -4565,6 +4566,12 @@ function getSignatures(type, kind, compiler, typeChecker) {
|
|
|
4565
4566
|
}
|
|
4566
4567
|
return typeChecker.getSignaturesOfType(type, kind);
|
|
4567
4568
|
}
|
|
4569
|
+
function getThisTypeOfSignature(signature, typeChecker) {
|
|
4570
|
+
return signature.thisParameter && typeChecker.getTypeOfSymbol(signature.thisParameter);
|
|
4571
|
+
}
|
|
4572
|
+
function getTypeParametersOfSignature(signature) {
|
|
4573
|
+
return signature.typeParameters ?? [];
|
|
4574
|
+
}
|
|
4568
4575
|
function getTypeParameterModifiers(typeParameter, compiler) {
|
|
4569
4576
|
if (!typeParameter.symbol.declarations) {
|
|
4570
4577
|
return compiler.ModifierFlags.None;
|
|
@@ -4583,9 +4590,6 @@ function isCheckFlagSet(symbol, flag, compiler) {
|
|
|
4583
4590
|
function isSymbolFromDefaultLibrary(symbol, program) {
|
|
4584
4591
|
return !!symbol.declarations?.every((declaration) => program.isSourceFileDefaultLibrary(declaration.getSourceFile()));
|
|
4585
4592
|
}
|
|
4586
|
-
function length(array) {
|
|
4587
|
-
return array?.length ?? 0;
|
|
4588
|
-
}
|
|
4589
4593
|
|
|
4590
4594
|
function getParameterFactsFromTuple(type, position, compiler) {
|
|
4591
4595
|
return {
|
|
@@ -4688,11 +4692,6 @@ class Structure {
|
|
|
4688
4692
|
}
|
|
4689
4693
|
return !a && !b;
|
|
4690
4694
|
}
|
|
4691
|
-
#compareTypeOfSymbol(a, b) {
|
|
4692
|
-
const aTypeOfSymbol = a && this.#typeChecker.getTypeOfSymbol(a);
|
|
4693
|
-
const bTypeOfSymbol = b && this.#typeChecker.getTypeOfSymbol(b);
|
|
4694
|
-
return this.#compareMaybeNullish(aTypeOfSymbol, bTypeOfSymbol);
|
|
4695
|
-
}
|
|
4696
4695
|
compare(a, b) {
|
|
4697
4696
|
a = this.#normalize(a);
|
|
4698
4697
|
b = this.#normalize(b);
|
|
@@ -4709,10 +4708,18 @@ class Structure {
|
|
|
4709
4708
|
return !!(b.flags & this.#compiler.TypeFlags.Undefined);
|
|
4710
4709
|
}
|
|
4711
4710
|
if ((a.flags | b.flags) & this.#compiler.TypeFlags.Intersection) {
|
|
4712
|
-
|
|
4713
|
-
this.compareIntersections(a, b))
|
|
4714
|
-
|
|
4715
|
-
|
|
4711
|
+
if (a.flags & b.flags & this.#compiler.TypeFlags.Intersection) {
|
|
4712
|
+
if (this.compareIntersections(a, b)) {
|
|
4713
|
+
return true;
|
|
4714
|
+
}
|
|
4715
|
+
}
|
|
4716
|
+
if (containsInstantiableType(a, this.#compiler) || containsInstantiableType(b, this.#compiler)) {
|
|
4717
|
+
return false;
|
|
4718
|
+
}
|
|
4719
|
+
if ((a.flags & b.flags) | this.#compiler.TypeFlags.StructuredType) {
|
|
4720
|
+
return this.#seen.memoized(a, b, () => this.compareStructuredTypes(a, b));
|
|
4721
|
+
}
|
|
4722
|
+
return false;
|
|
4716
4723
|
}
|
|
4717
4724
|
if ((a.flags | b.flags) & this.#compiler.TypeFlags.Union) {
|
|
4718
4725
|
if (a.flags & b.flags & this.#compiler.TypeFlags.Union) {
|
|
@@ -4762,6 +4769,12 @@ class Structure {
|
|
|
4762
4769
|
}
|
|
4763
4770
|
return false;
|
|
4764
4771
|
}
|
|
4772
|
+
if ((a.flags | b.flags) & this.#compiler.TypeFlags.StringMapping) {
|
|
4773
|
+
if (a.flags & b.flags & this.#compiler.TypeFlags.StringMapping) {
|
|
4774
|
+
return this.compareStringMappingTypes(a, b);
|
|
4775
|
+
}
|
|
4776
|
+
return false;
|
|
4777
|
+
}
|
|
4765
4778
|
return false;
|
|
4766
4779
|
}
|
|
4767
4780
|
compareIntersections(a, b) {
|
|
@@ -4795,16 +4808,18 @@ class Structure {
|
|
|
4795
4808
|
if ((a.objectFlags | b.objectFlags) & this.#compiler.ObjectFlags.Class) {
|
|
4796
4809
|
return this.compareStructuredTypes(a, b);
|
|
4797
4810
|
}
|
|
4798
|
-
if (
|
|
4811
|
+
if (a.symbol !== b.symbol) {
|
|
4799
4812
|
if (isSymbolFromDefaultLibrary(a.symbol, this.#program) || isSymbolFromDefaultLibrary(b.symbol, this.#program)) {
|
|
4800
4813
|
return false;
|
|
4801
4814
|
}
|
|
4802
4815
|
return;
|
|
4803
4816
|
}
|
|
4804
|
-
|
|
4817
|
+
const aTypeArguments = this.#typeChecker.getTypeArguments(a);
|
|
4818
|
+
const bTypeArguments = this.#typeChecker.getTypeArguments(b);
|
|
4819
|
+
if (aTypeArguments.length !== bTypeArguments.length) {
|
|
4805
4820
|
return false;
|
|
4806
4821
|
}
|
|
4807
|
-
return
|
|
4822
|
+
return aTypeArguments.every((type, i) => this.compare(type, bTypeArguments[i]));
|
|
4808
4823
|
}
|
|
4809
4824
|
compareTuples(a, b) {
|
|
4810
4825
|
if (a.target.readonly !== b.target.readonly) {
|
|
@@ -4812,7 +4827,7 @@ class Structure {
|
|
|
4812
4827
|
}
|
|
4813
4828
|
const aTypeArguments = this.#typeChecker.getTypeArguments(a);
|
|
4814
4829
|
const bTypeArguments = this.#typeChecker.getTypeArguments(b);
|
|
4815
|
-
if (length
|
|
4830
|
+
if (aTypeArguments.length !== bTypeArguments.length) {
|
|
4816
4831
|
return false;
|
|
4817
4832
|
}
|
|
4818
4833
|
for (let i = 0; i < aTypeArguments.length; i++) {
|
|
@@ -4894,17 +4909,17 @@ class Structure {
|
|
|
4894
4909
|
return true;
|
|
4895
4910
|
}
|
|
4896
4911
|
#compareSignature(a, b) {
|
|
4897
|
-
|
|
4912
|
+
const aTypeParameters = getTypeParametersOfSignature(a);
|
|
4913
|
+
const bTypeParameters = getTypeParametersOfSignature(b);
|
|
4914
|
+
if (aTypeParameters.length !== bTypeParameters.length) {
|
|
4898
4915
|
return false;
|
|
4899
4916
|
}
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
return false;
|
|
4904
|
-
}
|
|
4917
|
+
for (let i = 0; i < aTypeParameters.length; i++) {
|
|
4918
|
+
if (!this.compareTypeParameters(aTypeParameters[i], bTypeParameters[i])) {
|
|
4919
|
+
return false;
|
|
4905
4920
|
}
|
|
4906
4921
|
}
|
|
4907
|
-
if (!this.#
|
|
4922
|
+
if (!this.#compareMaybeNullish(getThisTypeOfSignature(a, this.#typeChecker), getThisTypeOfSignature(b, this.#typeChecker))) {
|
|
4908
4923
|
return false;
|
|
4909
4924
|
}
|
|
4910
4925
|
if (!this.compareParameters(a, b)) {
|
|
@@ -5020,6 +5035,15 @@ class Structure {
|
|
|
5020
5035
|
}
|
|
5021
5036
|
return true;
|
|
5022
5037
|
}
|
|
5038
|
+
compareStringMappingTypes(a, b) {
|
|
5039
|
+
if (a.symbol !== b.symbol) {
|
|
5040
|
+
return false;
|
|
5041
|
+
}
|
|
5042
|
+
if (!this.compare(a.type, b.type)) {
|
|
5043
|
+
return false;
|
|
5044
|
+
}
|
|
5045
|
+
return true;
|
|
5046
|
+
}
|
|
5023
5047
|
#normalize(type) {
|
|
5024
5048
|
if (type.flags & this.#compiler.TypeFlags.Freshable && type.freshType === type) {
|
|
5025
5049
|
return type.regularType;
|
|
@@ -5888,7 +5912,7 @@ class FileRunner {
|
|
|
5888
5912
|
class Runner {
|
|
5889
5913
|
#eventEmitter = new EventEmitter();
|
|
5890
5914
|
#resolvedConfig;
|
|
5891
|
-
static version = "6.0.0-beta.
|
|
5915
|
+
static version = "6.0.0-beta.6";
|
|
5892
5916
|
constructor(resolvedConfig) {
|
|
5893
5917
|
this.#resolvedConfig = resolvedConfig;
|
|
5894
5918
|
}
|