tstyche 6.0.2 → 6.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/dist/tstyche.js +78 -84
- package/package.json +1 -1
package/dist/tstyche.js
CHANGED
|
@@ -4569,9 +4569,6 @@ function getSignatures(type, kind, compiler, typeChecker) {
|
|
|
4569
4569
|
function getThisTypeOfSignature(signature, typeChecker) {
|
|
4570
4570
|
return signature.thisParameter && typeChecker.getTypeOfSymbol(signature.thisParameter);
|
|
4571
4571
|
}
|
|
4572
|
-
function getTypeParametersOfSignature(signature) {
|
|
4573
|
-
return signature.typeParameters ?? [];
|
|
4574
|
-
}
|
|
4575
4572
|
function getTypeParameterModifiers(typeParameter, compiler) {
|
|
4576
4573
|
if (!typeParameter.symbol.declarations) {
|
|
4577
4574
|
return compiler.ModifierFlags.None;
|
|
@@ -4676,7 +4673,7 @@ class Structure {
|
|
|
4676
4673
|
compare(a, b) {
|
|
4677
4674
|
a = this.#normalize(a);
|
|
4678
4675
|
b = this.#normalize(b);
|
|
4679
|
-
if (a
|
|
4676
|
+
if (a === b) {
|
|
4680
4677
|
return true;
|
|
4681
4678
|
}
|
|
4682
4679
|
if (a.flags & this.#compiler.TypeFlags.Any) {
|
|
@@ -4688,17 +4685,24 @@ class Structure {
|
|
|
4688
4685
|
if (a.flags & this.#compiler.TypeFlags.Undefined) {
|
|
4689
4686
|
return !!(b.flags & this.#compiler.TypeFlags.Undefined);
|
|
4690
4687
|
}
|
|
4691
|
-
if ((a.flags | b.flags) & this.#compiler.TypeFlags.
|
|
4692
|
-
if (a.flags & b.flags & this.#compiler.TypeFlags.
|
|
4693
|
-
|
|
4694
|
-
return true;
|
|
4695
|
-
}
|
|
4688
|
+
if ((a.flags | b.flags) & this.#compiler.TypeFlags.StructuredType) {
|
|
4689
|
+
if (a.flags & this.#compiler.TypeFlags.StructuredType && b.flags & this.#compiler.TypeFlags.StructuredType) {
|
|
4690
|
+
return this.#memoize(a, b, () => this.compareStructured(a, b));
|
|
4696
4691
|
}
|
|
4697
|
-
|
|
4698
|
-
|
|
4692
|
+
return false;
|
|
4693
|
+
}
|
|
4694
|
+
if ((a.flags | b.flags) & this.#compiler.TypeFlags.Instantiable) {
|
|
4695
|
+
if (a.flags & this.#compiler.TypeFlags.Instantiable && b.flags & this.#compiler.TypeFlags.Instantiable) {
|
|
4696
|
+
return this.#memoize(a, b, () => this.compareInstantiable(a, b));
|
|
4699
4697
|
}
|
|
4700
|
-
|
|
4701
|
-
|
|
4698
|
+
return false;
|
|
4699
|
+
}
|
|
4700
|
+
return false;
|
|
4701
|
+
}
|
|
4702
|
+
compareStructured(a, b) {
|
|
4703
|
+
if (this.#typeChecker.isTupleType(a) || this.#typeChecker.isTupleType(b)) {
|
|
4704
|
+
if (this.#typeChecker.isTupleType(a) && this.#typeChecker.isTupleType(b)) {
|
|
4705
|
+
return this.compareTuples(a, b);
|
|
4702
4706
|
}
|
|
4703
4707
|
return false;
|
|
4704
4708
|
}
|
|
@@ -4708,24 +4712,30 @@ class Structure {
|
|
|
4708
4712
|
}
|
|
4709
4713
|
return false;
|
|
4710
4714
|
}
|
|
4715
|
+
if ((a.flags | b.flags) & this.#compiler.TypeFlags.Intersection) {
|
|
4716
|
+
if (a.flags & b.flags & this.#compiler.TypeFlags.Intersection) {
|
|
4717
|
+
if (this.compareIntersections(a, b)) {
|
|
4718
|
+
return true;
|
|
4719
|
+
}
|
|
4720
|
+
}
|
|
4721
|
+
if (containsInstantiable(a, this.#compiler) || containsInstantiable(b, this.#compiler)) {
|
|
4722
|
+
return false;
|
|
4723
|
+
}
|
|
4724
|
+
}
|
|
4711
4725
|
if ((a.flags | b.flags) & this.#compiler.TypeFlags.Object) {
|
|
4712
4726
|
if (a.flags & b.flags & this.#compiler.TypeFlags.Object) {
|
|
4713
|
-
return this
|
|
4727
|
+
return this.compareObjects(a, b);
|
|
4714
4728
|
}
|
|
4715
|
-
return false;
|
|
4716
4729
|
}
|
|
4730
|
+
return this.compareStructures(a, b);
|
|
4731
|
+
}
|
|
4732
|
+
compareInstantiable(a, b) {
|
|
4717
4733
|
if ((a.flags | b.flags) & this.#compiler.TypeFlags.TypeParameter) {
|
|
4718
4734
|
if (a.flags & b.flags & this.#compiler.TypeFlags.TypeParameter) {
|
|
4719
4735
|
return this.compareTypeParameters(a, b);
|
|
4720
4736
|
}
|
|
4721
4737
|
return false;
|
|
4722
4738
|
}
|
|
4723
|
-
if ((a.flags | b.flags) & this.#compiler.TypeFlags.Index) {
|
|
4724
|
-
if (a.flags & b.flags & this.#compiler.TypeFlags.Index) {
|
|
4725
|
-
return this.compare(a.type, b.type);
|
|
4726
|
-
}
|
|
4727
|
-
return false;
|
|
4728
|
-
}
|
|
4729
4739
|
if ((a.flags | b.flags) & this.#compiler.TypeFlags.IndexedAccess) {
|
|
4730
4740
|
if (a.flags & b.flags & this.#compiler.TypeFlags.IndexedAccess) {
|
|
4731
4741
|
return this.compareIndexedAccessTypes(a, b);
|
|
@@ -4744,6 +4754,12 @@ class Structure {
|
|
|
4744
4754
|
}
|
|
4745
4755
|
return false;
|
|
4746
4756
|
}
|
|
4757
|
+
if ((a.flags | b.flags) & this.#compiler.TypeFlags.Index) {
|
|
4758
|
+
if (a.flags & b.flags & this.#compiler.TypeFlags.Index) {
|
|
4759
|
+
return this.compare(a.type, b.type);
|
|
4760
|
+
}
|
|
4761
|
+
return false;
|
|
4762
|
+
}
|
|
4747
4763
|
if ((a.flags | b.flags) & this.#compiler.TypeFlags.TemplateLiteral) {
|
|
4748
4764
|
if (a.flags & b.flags & this.#compiler.TypeFlags.TemplateLiteral) {
|
|
4749
4765
|
return this.compareTemplateLiteralTypes(a, b);
|
|
@@ -4754,7 +4770,6 @@ class Structure {
|
|
|
4754
4770
|
if (a.flags & b.flags & this.#compiler.TypeFlags.StringMapping) {
|
|
4755
4771
|
return this.compareStringMappingTypes(a, b);
|
|
4756
4772
|
}
|
|
4757
|
-
return false;
|
|
4758
4773
|
}
|
|
4759
4774
|
return false;
|
|
4760
4775
|
}
|
|
@@ -4780,29 +4795,23 @@ class Structure {
|
|
|
4780
4795
|
return this.compareTypeReferences(a, b);
|
|
4781
4796
|
}
|
|
4782
4797
|
}
|
|
4783
|
-
return this.
|
|
4798
|
+
return this.compareStructures(a, b);
|
|
4784
4799
|
}
|
|
4785
4800
|
compareTypeReferences(a, b) {
|
|
4786
|
-
if ((a.target
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
return false;
|
|
4791
|
-
}
|
|
4792
|
-
if (!this.compare(a.target, b.target)) {
|
|
4793
|
-
return this.compareStructuredTypes(a, b);
|
|
4794
|
-
}
|
|
4795
|
-
const aTypeArguments = this.#typeChecker.getTypeArguments(a);
|
|
4796
|
-
const bTypeArguments = this.#typeChecker.getTypeArguments(b);
|
|
4797
|
-
if (aTypeArguments.length !== bTypeArguments.length) {
|
|
4798
|
-
return false;
|
|
4799
|
-
}
|
|
4800
|
-
for (let i = 0; i < aTypeArguments.length; i++) {
|
|
4801
|
-
if (!this.compare(aTypeArguments[i], bTypeArguments[i])) {
|
|
4801
|
+
if (this.compare(a.target, b.target)) {
|
|
4802
|
+
const aTypeArguments = this.#typeChecker.getTypeArguments(a);
|
|
4803
|
+
const bTypeArguments = this.#typeChecker.getTypeArguments(b);
|
|
4804
|
+
if (aTypeArguments.length !== bTypeArguments.length) {
|
|
4802
4805
|
return false;
|
|
4803
4806
|
}
|
|
4807
|
+
for (let i = 0; i < aTypeArguments.length; i++) {
|
|
4808
|
+
if (!this.compare(aTypeArguments[i], bTypeArguments[i])) {
|
|
4809
|
+
return false;
|
|
4810
|
+
}
|
|
4811
|
+
}
|
|
4812
|
+
return true;
|
|
4804
4813
|
}
|
|
4805
|
-
return
|
|
4814
|
+
return this.compareStructures(a, b);
|
|
4806
4815
|
}
|
|
4807
4816
|
compareTuples(a, b) {
|
|
4808
4817
|
if (a.target.readonly !== b.target.readonly) {
|
|
@@ -4823,7 +4832,7 @@ class Structure {
|
|
|
4823
4832
|
}
|
|
4824
4833
|
return true;
|
|
4825
4834
|
}
|
|
4826
|
-
|
|
4835
|
+
compareStructures(a, b) {
|
|
4827
4836
|
if (!this.compareProperties(a, b)) {
|
|
4828
4837
|
return false;
|
|
4829
4838
|
}
|
|
@@ -4885,56 +4894,41 @@ class Structure {
|
|
|
4885
4894
|
return false;
|
|
4886
4895
|
}
|
|
4887
4896
|
for (let i = 0; i < aSignatures.length; i++) {
|
|
4888
|
-
|
|
4897
|
+
const aThisType = getThisTypeOfSignature(aSignatures[i], this.#typeChecker);
|
|
4898
|
+
const bThisType = getThisTypeOfSignature(bSignatures[i], this.#typeChecker);
|
|
4899
|
+
if (!this.#compareMaybeNullish(aThisType, bThisType)) {
|
|
4889
4900
|
return false;
|
|
4890
4901
|
}
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
#compareSignature(a, b) {
|
|
4895
|
-
const aTypeParameters = getTypeParametersOfSignature(a);
|
|
4896
|
-
const bTypeParameters = getTypeParametersOfSignature(b);
|
|
4897
|
-
if (aTypeParameters.length !== bTypeParameters.length) {
|
|
4898
|
-
return false;
|
|
4899
|
-
}
|
|
4900
|
-
for (let i = 0; i < aTypeParameters.length; i++) {
|
|
4901
|
-
if (!this.compareTypeParameters(aTypeParameters[i], bTypeParameters[i])) {
|
|
4902
|
+
const aParametersCount = getParameterCount(aSignatures[i], this.#compiler, this.#typeChecker);
|
|
4903
|
+
const bParametersCount = getParameterCount(bSignatures[i], this.#compiler, this.#typeChecker);
|
|
4904
|
+
if (aParametersCount !== bParametersCount) {
|
|
4902
4905
|
return false;
|
|
4903
4906
|
}
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
return true;
|
|
4921
|
-
}
|
|
4922
|
-
compareParameters(a, b) {
|
|
4923
|
-
const aParametersCount = getParameterCount(a, this.#compiler, this.#typeChecker);
|
|
4924
|
-
const bParametersCount = getParameterCount(b, this.#compiler, this.#typeChecker);
|
|
4925
|
-
if (aParametersCount !== bParametersCount) {
|
|
4926
|
-
return false;
|
|
4927
|
-
}
|
|
4928
|
-
for (let i = 0; i < aParametersCount; i++) {
|
|
4929
|
-
const aParameter = getParameterFacts(a, i, this.#compiler, this.#typeChecker);
|
|
4930
|
-
const bParameter = getParameterFacts(b, i, this.#compiler, this.#typeChecker);
|
|
4931
|
-
if (aParameter.isOptional !== bParameter.isOptional) {
|
|
4907
|
+
for (let j = 0; j < aParametersCount; j++) {
|
|
4908
|
+
const aParameter = getParameterFacts(aSignatures[i], j, this.#compiler, this.#typeChecker);
|
|
4909
|
+
const bParameter = getParameterFacts(bSignatures[i], j, this.#compiler, this.#typeChecker);
|
|
4910
|
+
if (aParameter.isOptional !== bParameter.isOptional) {
|
|
4911
|
+
return false;
|
|
4912
|
+
}
|
|
4913
|
+
if (aParameter.isRest !== bParameter.isRest) {
|
|
4914
|
+
return false;
|
|
4915
|
+
}
|
|
4916
|
+
if (!this.compare(aParameter.getType(this.#typeChecker), bParameter.getType(this.#typeChecker))) {
|
|
4917
|
+
return false;
|
|
4918
|
+
}
|
|
4919
|
+
}
|
|
4920
|
+
const aReturnType = this.#typeChecker.getReturnTypeOfSignature(aSignatures[i]);
|
|
4921
|
+
const bReturnType = this.#typeChecker.getReturnTypeOfSignature(bSignatures[i]);
|
|
4922
|
+
if (!this.compare(aReturnType, bReturnType)) {
|
|
4932
4923
|
return false;
|
|
4933
4924
|
}
|
|
4934
|
-
|
|
4925
|
+
const aTypePredicate = this.#typeChecker.getTypePredicateOfSignature(aSignatures[i]);
|
|
4926
|
+
const bTypePredicate = this.#typeChecker.getTypePredicateOfSignature(bSignatures[i]);
|
|
4927
|
+
if (aTypePredicate?.parameterIndex !== bTypePredicate?.parameterIndex) {
|
|
4935
4928
|
return false;
|
|
4936
4929
|
}
|
|
4937
|
-
if (
|
|
4930
|
+
if (aTypePredicate?.kind !== bTypePredicate?.kind ||
|
|
4931
|
+
!this.#compareMaybeNullish(aTypePredicate?.type, bTypePredicate?.type)) {
|
|
4938
4932
|
return false;
|
|
4939
4933
|
}
|
|
4940
4934
|
}
|
|
@@ -5920,7 +5914,7 @@ class FileRunner {
|
|
|
5920
5914
|
class Runner {
|
|
5921
5915
|
#eventEmitter = new EventEmitter();
|
|
5922
5916
|
#resolvedConfig;
|
|
5923
|
-
static version = "6.0.
|
|
5917
|
+
static version = "6.0.3";
|
|
5924
5918
|
constructor(resolvedConfig) {
|
|
5925
5919
|
this.#resolvedConfig = resolvedConfig;
|
|
5926
5920
|
}
|