@typescript-deploys/pr-build 5.4.0-pr-52968-11 → 5.4.0-pr-55924-28
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/lib/lib.es5.d.ts +0 -5
- package/lib/tsc.js +92 -91
- package/lib/tsserver.js +92 -91
- package/lib/typescript.d.ts +4 -9
- package/lib/typescript.js +93 -92
- package/lib/typingsInstaller.js +8 -6
- package/package.json +2 -2
package/lib/lib.es5.d.ts
CHANGED
|
@@ -1666,11 +1666,6 @@ type Capitalize<S extends string> = intrinsic;
|
|
|
1666
1666
|
*/
|
|
1667
1667
|
type Uncapitalize<S extends string> = intrinsic;
|
|
1668
1668
|
|
|
1669
|
-
/**
|
|
1670
|
-
* Blocks the contained type from participating in type inference.
|
|
1671
|
-
*/
|
|
1672
|
-
type NoInfer<T> = intrinsic;
|
|
1673
|
-
|
|
1674
1669
|
/**
|
|
1675
1670
|
* Marker for contextual 'this' type
|
|
1676
1671
|
*/
|
package/lib/tsc.js
CHANGED
|
@@ -3483,6 +3483,7 @@ var ModifierFlags = /* @__PURE__ */ ((ModifierFlags3) => {
|
|
|
3483
3483
|
return ModifierFlags3;
|
|
3484
3484
|
})(ModifierFlags || {});
|
|
3485
3485
|
var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
|
|
3486
|
+
RelationComparisonResult3[RelationComparisonResult3["None"] = 0] = "None";
|
|
3486
3487
|
RelationComparisonResult3[RelationComparisonResult3["Succeeded"] = 1] = "Succeeded";
|
|
3487
3488
|
RelationComparisonResult3[RelationComparisonResult3["Failed"] = 2] = "Failed";
|
|
3488
3489
|
RelationComparisonResult3[RelationComparisonResult3["Reported"] = 4] = "Reported";
|
|
@@ -3634,7 +3635,6 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3634
3635
|
TypeFlags2[TypeFlags2["NonPrimitive"] = 67108864] = "NonPrimitive";
|
|
3635
3636
|
TypeFlags2[TypeFlags2["TemplateLiteral"] = 134217728] = "TemplateLiteral";
|
|
3636
3637
|
TypeFlags2[TypeFlags2["StringMapping"] = 268435456] = "StringMapping";
|
|
3637
|
-
TypeFlags2[TypeFlags2["NoInfer"] = 536870912] = "NoInfer";
|
|
3638
3638
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
3639
3639
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
3640
3640
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
@@ -3658,14 +3658,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3658
3658
|
TypeFlags2[TypeFlags2["UnionOrIntersection"] = 3145728] = "UnionOrIntersection";
|
|
3659
3659
|
TypeFlags2[TypeFlags2["StructuredType"] = 3670016] = "StructuredType";
|
|
3660
3660
|
TypeFlags2[TypeFlags2["TypeVariable"] = 8650752] = "TypeVariable";
|
|
3661
|
-
TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] =
|
|
3661
|
+
TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] = 58982400] = "InstantiableNonPrimitive";
|
|
3662
3662
|
TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
|
|
3663
|
-
TypeFlags2[TypeFlags2["Instantiable"] =
|
|
3664
|
-
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] =
|
|
3663
|
+
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
|
|
3664
|
+
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
|
|
3665
3665
|
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
|
|
3666
3666
|
TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
|
|
3667
3667
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
3668
|
-
TypeFlags2[TypeFlags2["Narrowable"] =
|
|
3668
|
+
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
|
|
3669
3669
|
TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask";
|
|
3670
3670
|
TypeFlags2[TypeFlags2["IncludesMissingType"] = 262144 /* TypeParameter */] = "IncludesMissingType";
|
|
3671
3671
|
TypeFlags2[TypeFlags2["IncludesNonWideningType"] = 4194304 /* Index */] = "IncludesNonWideningType";
|
|
@@ -6781,6 +6781,8 @@ var Diagnostics = {
|
|
|
6781
6781
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
|
|
6782
6782
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
6783
6783
|
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, 1 /* Error */, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
6784
|
+
Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given: diag(4125, 1 /* Error */, "Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given_4125", "Each declaration of '{0}.{1}' differs in its value, where '{2}' was expected but '{3}' was given."),
|
|
6785
|
+
One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value: diag(4126, 1 /* Error */, "One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value_4126", "One value of '{0}.{1}' is the string '{2}', and the other is assumed to be an unknown numeric value."),
|
|
6784
6786
|
The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
6785
6787
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
6786
6788
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -43233,7 +43235,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
|
43233
43235
|
return SignatureCheckMode3;
|
|
43234
43236
|
})(SignatureCheckMode || {});
|
|
43235
43237
|
var isNotOverloadAndNotAccessor = and(isNotOverload, isNotAccessor);
|
|
43236
|
-
var
|
|
43238
|
+
var intrinsicTypeKinds = new Map(Object.entries({
|
|
43237
43239
|
Uppercase: 0 /* Uppercase */,
|
|
43238
43240
|
Lowercase: 1 /* Lowercase */,
|
|
43239
43241
|
Capitalize: 2 /* Capitalize */,
|
|
@@ -43790,7 +43792,7 @@ function createTypeChecker(host) {
|
|
|
43790
43792
|
var enumLiteralTypes = /* @__PURE__ */ new Map();
|
|
43791
43793
|
var indexedAccessTypes = /* @__PURE__ */ new Map();
|
|
43792
43794
|
var templateLiteralTypes = /* @__PURE__ */ new Map();
|
|
43793
|
-
var
|
|
43795
|
+
var stringMappingTypes = /* @__PURE__ */ new Map();
|
|
43794
43796
|
var substitutionTypes = /* @__PURE__ */ new Map();
|
|
43795
43797
|
var subtypeReductionCache = /* @__PURE__ */ new Map();
|
|
43796
43798
|
var decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
|
|
@@ -48066,10 +48068,6 @@ function createTypeChecker(host) {
|
|
|
48066
48068
|
const typeNode = typeToTypeNodeHelper(type.type, context);
|
|
48067
48069
|
return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]);
|
|
48068
48070
|
}
|
|
48069
|
-
if (type.flags & 536870912 /* NoInfer */) {
|
|
48070
|
-
const typeNode = typeToTypeNodeHelper(type.type, context);
|
|
48071
|
-
return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]);
|
|
48072
|
-
}
|
|
48073
48071
|
if (type.flags & 8388608 /* IndexedAccess */) {
|
|
48074
48072
|
const objectTypeNode = typeToTypeNodeHelper(type.objectType, context);
|
|
48075
48073
|
const indexTypeNode = typeToTypeNodeHelper(type.indexType, context);
|
|
@@ -51773,10 +51771,10 @@ function createTypeChecker(host) {
|
|
|
51773
51771
|
return result;
|
|
51774
51772
|
}
|
|
51775
51773
|
function isGenericTypeWithUndefinedConstraint(type) {
|
|
51776
|
-
return !!(type.flags &
|
|
51774
|
+
return !!(type.flags & 465829888 /* Instantiable */) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 32768 /* Undefined */);
|
|
51777
51775
|
}
|
|
51778
51776
|
function getNonUndefinedType(type) {
|
|
51779
|
-
const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags &
|
|
51777
|
+
const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t) : type;
|
|
51780
51778
|
return getTypeWithFacts(typeOrConstraint, 524288 /* NEUndefined */);
|
|
51781
51779
|
}
|
|
51782
51780
|
function getFlowTypeOfDestructuring(node, declaredType) {
|
|
@@ -51874,7 +51872,7 @@ function createTypeChecker(host) {
|
|
|
51874
51872
|
const elementType = checkIteratedTypeOrElementType(65 /* Destructuring */ | (declaration.dotDotDotToken ? 0 : 128 /* PossiblyOutOfBounds */), parentType, undefinedType, pattern);
|
|
51875
51873
|
const index = pattern.elements.indexOf(declaration);
|
|
51876
51874
|
if (declaration.dotDotDotToken) {
|
|
51877
|
-
const baseConstraint = mapType(parentType, (t) => t.flags &
|
|
51875
|
+
const baseConstraint = mapType(parentType, (t) => t.flags & 58982400 /* InstantiableNonPrimitive */ ? getBaseConstraintOrType(t) : t);
|
|
51878
51876
|
type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
|
|
51879
51877
|
} else if (isArrayLikeType(parentType)) {
|
|
51880
51878
|
const indexType = getNumberLiteralType(index);
|
|
@@ -54673,7 +54671,7 @@ function createTypeChecker(host) {
|
|
|
54673
54671
|
let constraints;
|
|
54674
54672
|
let hasDisjointDomainType = false;
|
|
54675
54673
|
for (const t of types) {
|
|
54676
|
-
if (t.flags &
|
|
54674
|
+
if (t.flags & 465829888 /* Instantiable */) {
|
|
54677
54675
|
let constraint = getConstraintOfType(t);
|
|
54678
54676
|
while (constraint && constraint.flags & (262144 /* TypeParameter */ | 4194304 /* Index */ | 16777216 /* Conditional */)) {
|
|
54679
54677
|
constraint = getConstraintOfType(constraint);
|
|
@@ -54705,7 +54703,7 @@ function createTypeChecker(host) {
|
|
|
54705
54703
|
return void 0;
|
|
54706
54704
|
}
|
|
54707
54705
|
function getBaseConstraintOfType(type) {
|
|
54708
|
-
if (type.flags & (
|
|
54706
|
+
if (type.flags & (58982400 /* InstantiableNonPrimitive */ | 3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || isGenericTupleType(type)) {
|
|
54709
54707
|
const constraint = getResolvedBaseConstraint(type);
|
|
54710
54708
|
return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : void 0;
|
|
54711
54709
|
}
|
|
@@ -54796,9 +54794,6 @@ function createTypeChecker(host) {
|
|
|
54796
54794
|
const constraint = getBaseConstraint(t.type);
|
|
54797
54795
|
return constraint && constraint !== t.type ? getStringMappingType(t.symbol, constraint) : stringType;
|
|
54798
54796
|
}
|
|
54799
|
-
if (t.flags & 536870912 /* NoInfer */) {
|
|
54800
|
-
return getBaseConstraint(t.type);
|
|
54801
|
-
}
|
|
54802
54797
|
if (t.flags & 8388608 /* IndexedAccess */) {
|
|
54803
54798
|
if (isMappedTypeGenericIndexedAccess(t)) {
|
|
54804
54799
|
return getBaseConstraint(substituteIndexedMappedType(t.objectType, t.indexType));
|
|
@@ -54879,7 +54874,7 @@ function createTypeChecker(host) {
|
|
|
54879
54874
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
54880
54875
|
}
|
|
54881
54876
|
function getApparentType(type) {
|
|
54882
|
-
const t = type.flags &
|
|
54877
|
+
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
54883
54878
|
const objectFlags = getObjectFlags(t);
|
|
54884
54879
|
return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
54885
54880
|
}
|
|
@@ -55988,11 +55983,8 @@ function createTypeChecker(host) {
|
|
|
55988
55983
|
}
|
|
55989
55984
|
function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
|
|
55990
55985
|
const type = getDeclaredTypeOfSymbol(symbol);
|
|
55991
|
-
if (type === intrinsicMarkerType && typeArguments && typeArguments.length === 1) {
|
|
55992
|
-
|
|
55993
|
-
return getStringMappingType(symbol, typeArguments[0]);
|
|
55994
|
-
}
|
|
55995
|
-
return getNoInferType(symbol, typeArguments[0]);
|
|
55986
|
+
if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
|
|
55987
|
+
return getStringMappingType(symbol, typeArguments[0]);
|
|
55996
55988
|
}
|
|
55997
55989
|
const links = getSymbolLinks(symbol);
|
|
55998
55990
|
const typeParameters = links.typeParameters;
|
|
@@ -56906,7 +56898,7 @@ function createTypeChecker(host) {
|
|
|
56906
56898
|
const type = elementTypes[i];
|
|
56907
56899
|
const flags = target.elementFlags[i];
|
|
56908
56900
|
if (flags & 8 /* Variadic */) {
|
|
56909
|
-
if (type.flags &
|
|
56901
|
+
if (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
|
|
56910
56902
|
addElement(type, 8 /* Variadic */, (_a = target.labeledElementDeclarations) == null ? void 0 : _a[i]);
|
|
56911
56903
|
} else if (isTupleType(type)) {
|
|
56912
56904
|
const elements = getElementTypes(type);
|
|
@@ -57013,7 +57005,7 @@ function createTypeChecker(host) {
|
|
|
57013
57005
|
const flags = type.flags;
|
|
57014
57006
|
if (!(flags & 131072 /* Never */)) {
|
|
57015
57007
|
includes |= flags & 473694207 /* IncludesMask */;
|
|
57016
|
-
if (flags &
|
|
57008
|
+
if (flags & 465829888 /* Instantiable */)
|
|
57017
57009
|
includes |= 33554432 /* IncludesInstantiable */;
|
|
57018
57010
|
if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */)
|
|
57019
57011
|
includes |= 268435456 /* IncludesConstrainedTypeVariable */;
|
|
@@ -57059,14 +57051,14 @@ function createTypeChecker(host) {
|
|
|
57059
57051
|
while (i > 0) {
|
|
57060
57052
|
i--;
|
|
57061
57053
|
const source = types[i];
|
|
57062
|
-
if (hasEmptyObject || source.flags &
|
|
57054
|
+
if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
57063
57055
|
if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
|
|
57064
57056
|
if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
|
|
57065
57057
|
orderedRemoveItemAt(types, i);
|
|
57066
57058
|
}
|
|
57067
57059
|
continue;
|
|
57068
57060
|
}
|
|
57069
|
-
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
57061
|
+
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
|
|
57070
57062
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
57071
57063
|
for (const target of types) {
|
|
57072
57064
|
if (source !== target) {
|
|
@@ -57079,7 +57071,7 @@ function createTypeChecker(host) {
|
|
|
57079
57071
|
}
|
|
57080
57072
|
}
|
|
57081
57073
|
count++;
|
|
57082
|
-
if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
57074
|
+
if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
57083
57075
|
const t = getTypeOfPropertyOfType(target, keyProperty.escapedName);
|
|
57084
57076
|
if (t && isUnitType(t) && getRegularTypeOfLiteralType(t) !== keyPropertyType) {
|
|
57085
57077
|
continue;
|
|
@@ -57679,7 +57671,7 @@ function createTypeChecker(host) {
|
|
|
57679
57671
|
);
|
|
57680
57672
|
}
|
|
57681
57673
|
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
57682
|
-
return !!(type.flags &
|
|
57674
|
+
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && (!hasDistributiveNameType(type) || getMappedTypeNameTypeKind(type) === 2 /* Remapping */) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
57683
57675
|
}
|
|
57684
57676
|
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
57685
57677
|
type = getReducedType(type);
|
|
@@ -57797,19 +57789,8 @@ function createTypeChecker(host) {
|
|
|
57797
57789
|
)
|
|
57798
57790
|
);
|
|
57799
57791
|
}
|
|
57800
|
-
function getNoInferType(symbol, type) {
|
|
57801
|
-
if (!isGenericType(type)) {
|
|
57802
|
-
return type;
|
|
57803
|
-
}
|
|
57804
|
-
const id = `${getSymbolId(symbol)},${getTypeId(type)}`;
|
|
57805
|
-
let result = intrinsicWrapperTypes.get(id);
|
|
57806
|
-
if (!result) {
|
|
57807
|
-
intrinsicWrapperTypes.set(id, result = createNoInferType(symbol, type));
|
|
57808
|
-
}
|
|
57809
|
-
return result;
|
|
57810
|
-
}
|
|
57811
57792
|
function applyStringMapping(symbol, str) {
|
|
57812
|
-
switch (
|
|
57793
|
+
switch (intrinsicTypeKinds.get(symbol.escapedName)) {
|
|
57813
57794
|
case 0 /* Uppercase */:
|
|
57814
57795
|
return str.toUpperCase();
|
|
57815
57796
|
case 1 /* Lowercase */:
|
|
@@ -57822,7 +57803,7 @@ function createTypeChecker(host) {
|
|
|
57822
57803
|
return str;
|
|
57823
57804
|
}
|
|
57824
57805
|
function applyTemplateStringMapping(symbol, texts, types) {
|
|
57825
|
-
switch (
|
|
57806
|
+
switch (intrinsicTypeKinds.get(symbol.escapedName)) {
|
|
57826
57807
|
case 0 /* Uppercase */:
|
|
57827
57808
|
return [texts.map((t) => t.toUpperCase()), types.map((t) => getStringMappingType(symbol, t))];
|
|
57828
57809
|
case 1 /* Lowercase */:
|
|
@@ -57836,9 +57817,9 @@ function createTypeChecker(host) {
|
|
|
57836
57817
|
}
|
|
57837
57818
|
function getStringMappingTypeForGenericType(symbol, type) {
|
|
57838
57819
|
const id = `${getSymbolId(symbol)},${getTypeId(type)}`;
|
|
57839
|
-
let result =
|
|
57820
|
+
let result = stringMappingTypes.get(id);
|
|
57840
57821
|
if (!result) {
|
|
57841
|
-
|
|
57822
|
+
stringMappingTypes.set(id, result = createStringMappingType(symbol, type));
|
|
57842
57823
|
}
|
|
57843
57824
|
return result;
|
|
57844
57825
|
}
|
|
@@ -57847,11 +57828,6 @@ function createTypeChecker(host) {
|
|
|
57847
57828
|
result.type = type;
|
|
57848
57829
|
return result;
|
|
57849
57830
|
}
|
|
57850
|
-
function createNoInferType(symbol, type) {
|
|
57851
|
-
const result = createTypeWithSymbol(536870912 /* NoInfer */, symbol);
|
|
57852
|
-
result.type = type;
|
|
57853
|
-
return result;
|
|
57854
|
-
}
|
|
57855
57831
|
function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) {
|
|
57856
57832
|
const type = createType(8388608 /* IndexedAccess */);
|
|
57857
57833
|
type.objectType = objectType;
|
|
@@ -57874,7 +57850,7 @@ function createTypeChecker(host) {
|
|
|
57874
57850
|
if (type.flags & 2097152 /* Intersection */) {
|
|
57875
57851
|
return some(type.types, isJSLiteralType);
|
|
57876
57852
|
}
|
|
57877
|
-
if (type.flags &
|
|
57853
|
+
if (type.flags & 465829888 /* Instantiable */) {
|
|
57878
57854
|
const constraint = getResolvedBaseConstraint(type);
|
|
57879
57855
|
return constraint !== type && isJSLiteralType(constraint);
|
|
57880
57856
|
}
|
|
@@ -58131,7 +58107,7 @@ function createTypeChecker(host) {
|
|
|
58131
58107
|
}
|
|
58132
58108
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
58133
58109
|
}
|
|
58134
|
-
return (type.flags &
|
|
58110
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
58135
58111
|
}
|
|
58136
58112
|
function getSimplifiedType(type, writing) {
|
|
58137
58113
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -58160,7 +58136,7 @@ function createTypeChecker(host) {
|
|
|
58160
58136
|
if (distributedOverIndex) {
|
|
58161
58137
|
return type[cache] = distributedOverIndex;
|
|
58162
58138
|
}
|
|
58163
|
-
if (!(indexType.flags &
|
|
58139
|
+
if (!(indexType.flags & 465829888 /* Instantiable */)) {
|
|
58164
58140
|
const distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
|
|
58165
58141
|
if (distributedOverObject) {
|
|
58166
58142
|
return type[cache] = distributedOverObject;
|
|
@@ -59237,7 +59213,7 @@ function createTypeChecker(host) {
|
|
|
59237
59213
|
return mapTypeWithAlias(
|
|
59238
59214
|
getReducedType(mappedTypeVariable),
|
|
59239
59215
|
(t) => {
|
|
59240
|
-
if (t.flags & (3 /* AnyOrUnknown */ |
|
|
59216
|
+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
59241
59217
|
if (!type.declaration.nameType) {
|
|
59242
59218
|
let constraint;
|
|
59243
59219
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
@@ -59409,9 +59385,6 @@ function createTypeChecker(host) {
|
|
|
59409
59385
|
if (flags & 268435456 /* StringMapping */) {
|
|
59410
59386
|
return getStringMappingType(type.symbol, instantiateType(type.type, mapper));
|
|
59411
59387
|
}
|
|
59412
|
-
if (flags & 536870912 /* NoInfer */) {
|
|
59413
|
-
return getNoInferType(type.symbol, instantiateType(type.type, mapper));
|
|
59414
|
-
}
|
|
59415
59388
|
if (flags & 8388608 /* IndexedAccess */) {
|
|
59416
59389
|
const newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
59417
59390
|
const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
@@ -59571,7 +59544,7 @@ function createTypeChecker(host) {
|
|
|
59571
59544
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
59572
59545
|
}
|
|
59573
59546
|
function isTypeDerivedFrom(source, target) {
|
|
59574
|
-
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags &
|
|
59547
|
+
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
|
|
59575
59548
|
}
|
|
59576
59549
|
function isTypeComparableTo(source, target) {
|
|
59577
59550
|
return isTypeRelatedTo(source, target, comparableRelation);
|
|
@@ -60346,12 +60319,12 @@ function createTypeChecker(host) {
|
|
|
60346
60319
|
return !!(entry & 1 /* Succeeded */);
|
|
60347
60320
|
}
|
|
60348
60321
|
const targetEnumType = getTypeOfSymbol(targetSymbol);
|
|
60349
|
-
for (const
|
|
60350
|
-
if (
|
|
60351
|
-
const targetProperty = getPropertyOfType(targetEnumType,
|
|
60322
|
+
for (const sourceProperty of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) {
|
|
60323
|
+
if (sourceProperty.flags & 8 /* EnumMember */) {
|
|
60324
|
+
const targetProperty = getPropertyOfType(targetEnumType, sourceProperty.escapedName);
|
|
60352
60325
|
if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) {
|
|
60353
60326
|
if (errorReporter) {
|
|
60354
|
-
errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(
|
|
60327
|
+
errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(sourceProperty), typeToString(
|
|
60355
60328
|
getDeclaredTypeOfSymbol(targetSymbol),
|
|
60356
60329
|
/*enclosingDeclaration*/
|
|
60357
60330
|
void 0,
|
|
@@ -60363,6 +60336,34 @@ function createTypeChecker(host) {
|
|
|
60363
60336
|
}
|
|
60364
60337
|
return false;
|
|
60365
60338
|
}
|
|
60339
|
+
const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, 306 /* EnumMember */));
|
|
60340
|
+
const targetValue = getEnumMemberValue(getDeclarationOfKind(targetProperty, 306 /* EnumMember */));
|
|
60341
|
+
if (sourceValue !== targetValue) {
|
|
60342
|
+
const sourceIsString = typeof sourceValue === "string";
|
|
60343
|
+
const targetIsString = typeof targetValue === "string";
|
|
60344
|
+
if (sourceValue !== void 0 && targetValue !== void 0) {
|
|
60345
|
+
if (!errorReporter) {
|
|
60346
|
+
enumRelation.set(id, 2 /* Failed */);
|
|
60347
|
+
} else {
|
|
60348
|
+
const escapedSource = sourceIsString ? `"${escapeString(sourceValue)}"` : sourceValue;
|
|
60349
|
+
const escapedTarget = targetIsString ? `"${escapeString(targetValue)}"` : targetValue;
|
|
60350
|
+
errorReporter(Diagnostics.Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given, symbolName(targetSymbol), symbolName(targetProperty), escapedTarget, escapedSource);
|
|
60351
|
+
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
60352
|
+
}
|
|
60353
|
+
return false;
|
|
60354
|
+
} else if (sourceIsString || targetIsString) {
|
|
60355
|
+
if (!errorReporter) {
|
|
60356
|
+
enumRelation.set(id, 2 /* Failed */);
|
|
60357
|
+
} else {
|
|
60358
|
+
const knownStringValue = sourceValue ?? targetValue;
|
|
60359
|
+
Debug.assert(typeof knownStringValue === "string");
|
|
60360
|
+
const escapedValue = `"${escapeString(knownStringValue)}"`;
|
|
60361
|
+
errorReporter(Diagnostics.One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value, symbolName(targetSymbol), symbolName(targetProperty), escapedValue);
|
|
60362
|
+
enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
|
|
60363
|
+
}
|
|
60364
|
+
return false;
|
|
60365
|
+
}
|
|
60366
|
+
}
|
|
60366
60367
|
}
|
|
60367
60368
|
}
|
|
60368
60369
|
enumRelation.set(id, 1 /* Succeeded */);
|
|
@@ -60450,7 +60451,7 @@ function createTypeChecker(host) {
|
|
|
60450
60451
|
return !!(related & 1 /* Succeeded */);
|
|
60451
60452
|
}
|
|
60452
60453
|
}
|
|
60453
|
-
if (source.flags &
|
|
60454
|
+
if (source.flags & 469499904 /* StructuredOrInstantiable */ || target.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
60454
60455
|
return checkTypeRelatedTo(
|
|
60455
60456
|
source,
|
|
60456
60457
|
target,
|
|
@@ -60466,7 +60467,7 @@ function createTypeChecker(host) {
|
|
|
60466
60467
|
}
|
|
60467
60468
|
function getNormalizedType(type, writing) {
|
|
60468
60469
|
while (true) {
|
|
60469
|
-
const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type
|
|
60470
|
+
const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type;
|
|
60470
60471
|
if (t === type)
|
|
60471
60472
|
return t;
|
|
60472
60473
|
type = t;
|
|
@@ -60855,7 +60856,7 @@ function createTypeChecker(host) {
|
|
|
60855
60856
|
}
|
|
60856
60857
|
if (relation === comparableRelation && !(target2.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(target2, source2, relation) || isSimpleTypeRelatedTo(source2, target2, relation, reportErrors2 ? reportError : void 0))
|
|
60857
60858
|
return -1 /* True */;
|
|
60858
|
-
if (source2.flags &
|
|
60859
|
+
if (source2.flags & 469499904 /* StructuredOrInstantiable */ || target2.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
60859
60860
|
const isPerformingExcessPropertyChecks = !(intersectionState & 2 /* Target */) && (isObjectLiteralType(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */);
|
|
60860
60861
|
if (isPerformingExcessPropertyChecks) {
|
|
60861
60862
|
if (hasExcessProperties(source2, target2, reportErrors2)) {
|
|
@@ -60894,7 +60895,7 @@ function createTypeChecker(host) {
|
|
|
60894
60895
|
return 0 /* False */;
|
|
60895
60896
|
}
|
|
60896
60897
|
traceUnionsOrIntersectionsTooLarge(source2, target2);
|
|
60897
|
-
const skipCaching = source2.flags & 1048576 /* Union */ && source2.types.length < 4 && !(target2.flags & 1048576 /* Union */) || target2.flags & 1048576 /* Union */ && target2.types.length < 4 && !(source2.flags &
|
|
60898
|
+
const skipCaching = source2.flags & 1048576 /* Union */ && source2.types.length < 4 && !(target2.flags & 1048576 /* Union */) || target2.flags & 1048576 /* Union */ && target2.types.length < 4 && !(source2.flags & 469499904 /* StructuredOrInstantiable */);
|
|
60898
60899
|
const result2 = skipCaching ? unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) : recursiveTypeRelatedTo(source2, target2, reportErrors2, intersectionState, recursionFlags);
|
|
60899
60900
|
if (result2) {
|
|
60900
60901
|
return result2;
|
|
@@ -61083,7 +61084,7 @@ function createTypeChecker(host) {
|
|
|
61083
61084
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
61084
61085
|
}
|
|
61085
61086
|
if (relation === comparableRelation && target2.flags & 402784252 /* Primitive */) {
|
|
61086
|
-
const constraints = sameMap(source2.types, (t) => t.flags &
|
|
61087
|
+
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
61087
61088
|
if (constraints !== source2.types) {
|
|
61088
61089
|
source2 = getIntersectionType(constraints);
|
|
61089
61090
|
if (source2.flags & 131072 /* Never */) {
|
|
@@ -61675,7 +61676,7 @@ function createTypeChecker(host) {
|
|
|
61675
61676
|
if (result2 = unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState)) {
|
|
61676
61677
|
return result2;
|
|
61677
61678
|
}
|
|
61678
|
-
if (!(sourceFlags &
|
|
61679
|
+
if (!(sourceFlags & 465829888 /* Instantiable */ || sourceFlags & 524288 /* Object */ && targetFlags & 1048576 /* Union */ || sourceFlags & 2097152 /* Intersection */ && targetFlags & (524288 /* Object */ | 1048576 /* Union */ | 465829888 /* Instantiable */))) {
|
|
61679
61680
|
return 0 /* False */;
|
|
61680
61681
|
}
|
|
61681
61682
|
}
|
|
@@ -62838,7 +62839,7 @@ function createTypeChecker(host) {
|
|
|
62838
62839
|
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
62839
62840
|
return !!forEach(type.types, typeCouldHaveTopLevelSingletonTypes);
|
|
62840
62841
|
}
|
|
62841
|
-
if (type.flags &
|
|
62842
|
+
if (type.flags & 465829888 /* Instantiable */) {
|
|
62842
62843
|
const constraint = getConstraintOfType(type);
|
|
62843
62844
|
if (constraint && constraint !== type) {
|
|
62844
62845
|
return typeCouldHaveTopLevelSingletonTypes(constraint);
|
|
@@ -63895,7 +63896,7 @@ function createTypeChecker(host) {
|
|
|
63895
63896
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
63896
63897
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
63897
63898
|
}
|
|
63898
|
-
const result = !!(type.flags &
|
|
63899
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
63899
63900
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
63900
63901
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
63901
63902
|
}
|
|
@@ -64187,7 +64188,7 @@ function createTypeChecker(host) {
|
|
|
64187
64188
|
let expandingFlags = 0 /* None */;
|
|
64188
64189
|
inferFromTypes(originalSource, originalTarget);
|
|
64189
64190
|
function inferFromTypes(source, target) {
|
|
64190
|
-
if (!couldContainTypeVariables(target)
|
|
64191
|
+
if (!couldContainTypeVariables(target)) {
|
|
64191
64192
|
return;
|
|
64192
64193
|
}
|
|
64193
64194
|
if (source === wildcardType || source === blockedStringType) {
|
|
@@ -64290,7 +64291,7 @@ function createTypeChecker(host) {
|
|
|
64290
64291
|
/*writing*/
|
|
64291
64292
|
false
|
|
64292
64293
|
);
|
|
64293
|
-
if (indexType.flags &
|
|
64294
|
+
if (indexType.flags & 465829888 /* Instantiable */) {
|
|
64294
64295
|
const simplified2 = distributeIndexOverObjectType(
|
|
64295
64296
|
getSimplifiedType(
|
|
64296
64297
|
target.objectType,
|
|
@@ -64337,7 +64338,7 @@ function createTypeChecker(host) {
|
|
|
64337
64338
|
inferToTemplateLiteralType(source, target);
|
|
64338
64339
|
} else {
|
|
64339
64340
|
source = getReducedType(source);
|
|
64340
|
-
if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ |
|
|
64341
|
+
if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */))) {
|
|
64341
64342
|
const apparentSource = getApparentType(source);
|
|
64342
64343
|
if (apparentSource !== source && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
|
|
64343
64344
|
return inferFromTypes(apparentSource, target);
|
|
@@ -65080,7 +65081,7 @@ function createTypeChecker(host) {
|
|
|
65080
65081
|
const map2 = /* @__PURE__ */ new Map();
|
|
65081
65082
|
let count = 0;
|
|
65082
65083
|
for (const type of types) {
|
|
65083
|
-
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
65084
|
+
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
65084
65085
|
const discriminant = getTypeOfPropertyOfType(type, name);
|
|
65085
65086
|
if (discriminant) {
|
|
65086
65087
|
if (!isLiteralType(discriminant)) {
|
|
@@ -65106,11 +65107,11 @@ function createTypeChecker(host) {
|
|
|
65106
65107
|
}
|
|
65107
65108
|
function getKeyPropertyName(unionType) {
|
|
65108
65109
|
const types = unionType.types;
|
|
65109
|
-
if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ |
|
|
65110
|
+
if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */))) < 10) {
|
|
65110
65111
|
return void 0;
|
|
65111
65112
|
}
|
|
65112
65113
|
if (unionType.keyPropertyName === void 0) {
|
|
65113
|
-
const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ |
|
|
65114
|
+
const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */) ? forEach(getPropertiesOfType(t), (p) => isUnitType(getTypeOfSymbol(p)) ? p.escapedName : void 0) : void 0);
|
|
65114
65115
|
const mapByKeyProperty = keyPropertyName && mapTypesByKeyProperty(types, keyPropertyName);
|
|
65115
65116
|
unionType.keyPropertyName = mapByKeyProperty ? keyPropertyName : "";
|
|
65116
65117
|
unionType.constituentMap = mapByKeyProperty;
|
|
@@ -65193,7 +65194,7 @@ function createTypeChecker(host) {
|
|
|
65193
65194
|
return getTypeFacts(type, mask) !== 0;
|
|
65194
65195
|
}
|
|
65195
65196
|
function getTypeFactsWorker(type, callerOnlyNeeds) {
|
|
65196
|
-
if (type.flags & (2097152 /* Intersection */ |
|
|
65197
|
+
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
65197
65198
|
type = getBaseConstraintOfType(type) || unknownType;
|
|
65198
65199
|
}
|
|
65199
65200
|
const flags = type.flags;
|
|
@@ -66821,7 +66822,7 @@ function createTypeChecker(host) {
|
|
|
66821
66822
|
matching || type,
|
|
66822
66823
|
checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType
|
|
66823
66824
|
);
|
|
66824
|
-
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t,
|
|
66825
|
+
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
66825
66826
|
});
|
|
66826
66827
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
66827
66828
|
}
|
|
@@ -67009,10 +67010,10 @@ function createTypeChecker(host) {
|
|
|
67009
67010
|
return parent.kind === 211 /* PropertyAccessExpression */ || parent.kind === 166 /* QualifiedName */ || parent.kind === 213 /* CallExpression */ && parent.expression === node || parent.kind === 212 /* ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
|
|
67010
67011
|
}
|
|
67011
67012
|
function isGenericTypeWithUnionConstraint(type) {
|
|
67012
|
-
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags &
|
|
67013
|
+
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
|
|
67013
67014
|
}
|
|
67014
67015
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
67015
|
-
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags &
|
|
67016
|
+
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
67016
67017
|
}
|
|
67017
67018
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
67018
67019
|
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 32 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
|
|
@@ -67909,7 +67910,7 @@ function createTypeChecker(host) {
|
|
|
67909
67910
|
const functionFlags = getFunctionFlags(functionDecl);
|
|
67910
67911
|
if (functionFlags & 1 /* Generator */) {
|
|
67911
67912
|
return filterType(returnType2, (t) => {
|
|
67912
|
-
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ |
|
|
67913
|
+
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || checkGeneratorInstantiationAssignabilityToReturnType(
|
|
67913
67914
|
t,
|
|
67914
67915
|
functionFlags,
|
|
67915
67916
|
/*errorNode*/
|
|
@@ -67919,7 +67920,7 @@ function createTypeChecker(host) {
|
|
|
67919
67920
|
}
|
|
67920
67921
|
if (functionFlags & 2 /* Async */) {
|
|
67921
67922
|
return filterType(returnType2, (t) => {
|
|
67922
|
-
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ |
|
|
67923
|
+
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || !!getAwaitedTypeOfPromise(t);
|
|
67923
67924
|
});
|
|
67924
67925
|
}
|
|
67925
67926
|
return returnType2;
|
|
@@ -68398,7 +68399,7 @@ function createTypeChecker(host) {
|
|
|
68398
68399
|
}
|
|
68399
68400
|
}
|
|
68400
68401
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
68401
|
-
if (contextualType && maybeTypeOfKind(contextualType,
|
|
68402
|
+
if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* Instantiable */)) {
|
|
68402
68403
|
const inferenceContext = getInferenceContext(node);
|
|
68403
68404
|
if (inferenceContext && contextFlags & 1 /* Signature */ && some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
|
|
68404
68405
|
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
@@ -68411,7 +68412,7 @@ function createTypeChecker(host) {
|
|
|
68411
68412
|
return contextualType;
|
|
68412
68413
|
}
|
|
68413
68414
|
function instantiateInstantiableTypes(type, mapper) {
|
|
68414
|
-
if (type.flags &
|
|
68415
|
+
if (type.flags & 465829888 /* Instantiable */) {
|
|
68415
68416
|
return instantiateType(type, mapper);
|
|
68416
68417
|
}
|
|
68417
68418
|
if (type.flags & 1048576 /* Union */) {
|
|
@@ -69169,7 +69170,7 @@ function createTypeChecker(host) {
|
|
|
69169
69170
|
}
|
|
69170
69171
|
function isValidSpreadType(type) {
|
|
69171
69172
|
const t = removeDefinitelyFalsyTypes(mapType(type, getBaseConstraintOrType));
|
|
69172
|
-
return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ |
|
|
69173
|
+
return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */) || t.flags & 3145728 /* UnionOrIntersection */ && every(t.types, isValidSpreadType));
|
|
69173
69174
|
}
|
|
69174
69175
|
function checkJsxSelfClosingElementDeferred(node) {
|
|
69175
69176
|
checkJsxOpeningLikeElementOrOpeningFragment(node);
|
|
@@ -72849,7 +72850,7 @@ function createTypeChecker(host) {
|
|
|
72849
72850
|
result3.node = node;
|
|
72850
72851
|
return result3;
|
|
72851
72852
|
}
|
|
72852
|
-
} else if (type2.flags &
|
|
72853
|
+
} else if (type2.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
72853
72854
|
const constraint = getBaseConstraintOfType(type2);
|
|
72854
72855
|
if (constraint) {
|
|
72855
72856
|
const instantiated = getInstantiatedTypePart(constraint);
|
|
@@ -75212,7 +75213,7 @@ function createTypeChecker(host) {
|
|
|
75212
75213
|
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
75213
75214
|
}
|
|
75214
75215
|
function isTemplateLiteralContextualType(type) {
|
|
75215
|
-
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags &
|
|
75216
|
+
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
75216
75217
|
}
|
|
75217
75218
|
function getContextNode(node) {
|
|
75218
75219
|
if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
|
|
@@ -75325,7 +75326,7 @@ function createTypeChecker(host) {
|
|
|
75325
75326
|
const types = contextualType.types;
|
|
75326
75327
|
return some(types, (t) => isLiteralOfContextualType(candidateType, t));
|
|
75327
75328
|
}
|
|
75328
|
-
if (contextualType.flags &
|
|
75329
|
+
if (contextualType.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
75329
75330
|
const constraint = getBaseConstraintOfType(contextualType) || unknownType;
|
|
75330
75331
|
return maybeTypeOfKind(constraint, 4 /* String */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) || maybeTypeOfKind(constraint, 8 /* Number */) && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) || maybeTypeOfKind(constraint, 64 /* BigInt */) && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) || maybeTypeOfKind(constraint, 4096 /* ESSymbol */) && maybeTypeOfKind(candidateType, 8192 /* UniqueESSymbol */) || isLiteralOfContextualType(candidateType, constraint);
|
|
75331
75332
|
}
|
|
@@ -78395,7 +78396,7 @@ function createTypeChecker(host) {
|
|
|
78395
78396
|
);
|
|
78396
78397
|
}
|
|
78397
78398
|
}
|
|
78398
|
-
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ |
|
|
78399
|
+
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
78399
78400
|
error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType));
|
|
78400
78401
|
}
|
|
78401
78402
|
checkSourceElement(node.statement);
|
|
@@ -80054,7 +80055,7 @@ function createTypeChecker(host) {
|
|
|
80054
80055
|
checkExportsOnMergedDeclarations(node);
|
|
80055
80056
|
checkTypeParameters(node.typeParameters);
|
|
80056
80057
|
if (node.type.kind === 141 /* IntrinsicKeyword */) {
|
|
80057
|
-
if (!
|
|
80058
|
+
if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) {
|
|
80058
80059
|
error(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
|
|
80059
80060
|
}
|
|
80060
80061
|
} else {
|