@typescript-deploys/pr-build 5.1.0-pr-52968-5 → 5.1.0-pr-53258-7
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 +94 -139
- package/lib/tsserver.js +112 -139
- package/lib/tsserverlibrary.d.ts +4 -9
- package/lib/tsserverlibrary.js +114 -142
- package/lib/typescript.d.ts +4 -9
- package/lib/typescript.js +113 -142
- package/lib/typingsInstaller.js +7 -7
- package/package.json +3 -3
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.1";
|
|
26
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
26
|
+
var version = `${versionMajorMinor}.0-insiders.20230314`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -3706,7 +3706,6 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3706
3706
|
TypeFlags2[TypeFlags2["NonPrimitive"] = 67108864] = "NonPrimitive";
|
|
3707
3707
|
TypeFlags2[TypeFlags2["TemplateLiteral"] = 134217728] = "TemplateLiteral";
|
|
3708
3708
|
TypeFlags2[TypeFlags2["StringMapping"] = 268435456] = "StringMapping";
|
|
3709
|
-
TypeFlags2[TypeFlags2["NoInfer"] = 536870912] = "NoInfer";
|
|
3710
3709
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
3711
3710
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
3712
3711
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
@@ -3730,14 +3729,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3730
3729
|
TypeFlags2[TypeFlags2["UnionOrIntersection"] = 3145728] = "UnionOrIntersection";
|
|
3731
3730
|
TypeFlags2[TypeFlags2["StructuredType"] = 3670016] = "StructuredType";
|
|
3732
3731
|
TypeFlags2[TypeFlags2["TypeVariable"] = 8650752] = "TypeVariable";
|
|
3733
|
-
TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] =
|
|
3732
|
+
TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] = 58982400] = "InstantiableNonPrimitive";
|
|
3734
3733
|
TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
|
|
3735
|
-
TypeFlags2[TypeFlags2["Instantiable"] =
|
|
3736
|
-
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] =
|
|
3734
|
+
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
|
|
3735
|
+
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
|
|
3737
3736
|
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
|
|
3738
3737
|
TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
|
|
3739
3738
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
3740
|
-
TypeFlags2[TypeFlags2["Narrowable"] =
|
|
3739
|
+
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
|
|
3741
3740
|
TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask";
|
|
3742
3741
|
TypeFlags2[TypeFlags2["IncludesMissingType"] = 262144 /* TypeParameter */] = "IncludesMissingType";
|
|
3743
3742
|
TypeFlags2[TypeFlags2["IncludesNonWideningType"] = 4194304 /* Index */] = "IncludesNonWideningType";
|
|
@@ -5936,6 +5935,7 @@ var Diagnostics = {
|
|
|
5936
5935
|
Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: diag(1250, 1 /* Error */, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'."),
|
|
5937
5936
|
Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: diag(1251, 1 /* Error */, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode."),
|
|
5938
5937
|
Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: diag(1252, 1 /* Error */, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode."),
|
|
5938
|
+
Abstract_properties_can_only_appear_within_an_abstract_class: diag(1253, 1 /* Error */, "Abstract_properties_can_only_appear_within_an_abstract_class_1253", "Abstract properties can only appear within an abstract class."),
|
|
5939
5939
|
A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference: diag(1254, 1 /* Error */, "A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_refere_1254", "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference."),
|
|
5940
5940
|
A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, 1 /* Error */, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."),
|
|
5941
5941
|
A_required_element_cannot_follow_an_optional_element: diag(1257, 1 /* Error */, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
|
|
@@ -42604,7 +42604,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
|
42604
42604
|
return SignatureCheckMode3;
|
|
42605
42605
|
})(SignatureCheckMode || {});
|
|
42606
42606
|
var isNotOverloadAndNotAccessor = and(isNotOverload, isNotAccessor);
|
|
42607
|
-
var
|
|
42607
|
+
var intrinsicTypeKinds = new Map(Object.entries({
|
|
42608
42608
|
Uppercase: 0 /* Uppercase */,
|
|
42609
42609
|
Lowercase: 1 /* Lowercase */,
|
|
42610
42610
|
Capitalize: 2 /* Capitalize */,
|
|
@@ -42682,6 +42682,7 @@ function createTypeChecker(host) {
|
|
|
42682
42682
|
var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis");
|
|
42683
42683
|
var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables");
|
|
42684
42684
|
var keyofStringsOnly = !!compilerOptions.keyofStringsOnly;
|
|
42685
|
+
var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */;
|
|
42685
42686
|
var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */;
|
|
42686
42687
|
var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes;
|
|
42687
42688
|
var checkBinaryExpression = createCheckBinaryExpression();
|
|
@@ -43129,7 +43130,7 @@ function createTypeChecker(host) {
|
|
|
43129
43130
|
var enumLiteralTypes = /* @__PURE__ */ new Map();
|
|
43130
43131
|
var indexedAccessTypes = /* @__PURE__ */ new Map();
|
|
43131
43132
|
var templateLiteralTypes = /* @__PURE__ */ new Map();
|
|
43132
|
-
var
|
|
43133
|
+
var stringMappingTypes = /* @__PURE__ */ new Map();
|
|
43133
43134
|
var substitutionTypes = /* @__PURE__ */ new Map();
|
|
43134
43135
|
var subtypeReductionCache = /* @__PURE__ */ new Map();
|
|
43135
43136
|
var decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
|
|
@@ -47263,10 +47264,6 @@ function createTypeChecker(host) {
|
|
|
47263
47264
|
const typeNode = typeToTypeNodeHelper(type.type, context);
|
|
47264
47265
|
return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]);
|
|
47265
47266
|
}
|
|
47266
|
-
if (type.flags & 536870912 /* NoInfer */) {
|
|
47267
|
-
const typeNode = typeToTypeNodeHelper(type.type, context);
|
|
47268
|
-
return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]);
|
|
47269
|
-
}
|
|
47270
47267
|
if (type.flags & 8388608 /* IndexedAccess */) {
|
|
47271
47268
|
const objectTypeNode = typeToTypeNodeHelper(type.objectType, context);
|
|
47272
47269
|
const indexTypeNode = typeToTypeNodeHelper(type.indexType, context);
|
|
@@ -50725,10 +50722,10 @@ function createTypeChecker(host) {
|
|
|
50725
50722
|
return result;
|
|
50726
50723
|
}
|
|
50727
50724
|
function isGenericTypeWithUndefinedConstraint(type) {
|
|
50728
|
-
return !!(type.flags &
|
|
50725
|
+
return !!(type.flags & 465829888 /* Instantiable */) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 32768 /* Undefined */);
|
|
50729
50726
|
}
|
|
50730
50727
|
function getNonUndefinedType(type) {
|
|
50731
|
-
const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags &
|
|
50728
|
+
const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t) : type;
|
|
50732
50729
|
return getTypeWithFacts(typeOrConstraint, 524288 /* NEUndefined */);
|
|
50733
50730
|
}
|
|
50734
50731
|
function getFlowTypeOfDestructuring(node, declaredType) {
|
|
@@ -53547,7 +53544,7 @@ function createTypeChecker(host) {
|
|
|
53547
53544
|
let constraints;
|
|
53548
53545
|
let hasDisjointDomainType = false;
|
|
53549
53546
|
for (const t of types) {
|
|
53550
|
-
if (t.flags &
|
|
53547
|
+
if (t.flags & 465829888 /* Instantiable */) {
|
|
53551
53548
|
let constraint = getConstraintOfType(t);
|
|
53552
53549
|
while (constraint && constraint.flags & (262144 /* TypeParameter */ | 4194304 /* Index */ | 16777216 /* Conditional */)) {
|
|
53553
53550
|
constraint = getConstraintOfType(constraint);
|
|
@@ -53579,7 +53576,7 @@ function createTypeChecker(host) {
|
|
|
53579
53576
|
return void 0;
|
|
53580
53577
|
}
|
|
53581
53578
|
function getBaseConstraintOfType(type) {
|
|
53582
|
-
if (type.flags & (
|
|
53579
|
+
if (type.flags & (58982400 /* InstantiableNonPrimitive */ | 3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) {
|
|
53583
53580
|
const constraint = getResolvedBaseConstraint(type);
|
|
53584
53581
|
return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : void 0;
|
|
53585
53582
|
}
|
|
@@ -53670,9 +53667,6 @@ function createTypeChecker(host) {
|
|
|
53670
53667
|
const constraint = getBaseConstraint(t.type);
|
|
53671
53668
|
return constraint && constraint !== t.type ? getStringMappingType(t.symbol, constraint) : stringType;
|
|
53672
53669
|
}
|
|
53673
|
-
if (t.flags & 536870912 /* NoInfer */) {
|
|
53674
|
-
return getBaseConstraint(t.type);
|
|
53675
|
-
}
|
|
53676
53670
|
if (t.flags & 8388608 /* IndexedAccess */) {
|
|
53677
53671
|
if (isMappedTypeGenericIndexedAccess(t)) {
|
|
53678
53672
|
return getBaseConstraint(substituteIndexedMappedType(t.objectType, t.indexType));
|
|
@@ -53746,7 +53740,7 @@ function createTypeChecker(host) {
|
|
|
53746
53740
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
53747
53741
|
}
|
|
53748
53742
|
function getApparentType(type) {
|
|
53749
|
-
const t = !(type.flags &
|
|
53743
|
+
const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
|
|
53750
53744
|
return getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : 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;
|
|
53751
53745
|
}
|
|
53752
53746
|
function getReducedApparentType(type) {
|
|
@@ -53957,6 +53951,13 @@ function createTypeChecker(host) {
|
|
|
53957
53951
|
function isConflictingPrivateProperty(prop) {
|
|
53958
53952
|
return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */);
|
|
53959
53953
|
}
|
|
53954
|
+
function isGenericReducibleType(type) {
|
|
53955
|
+
return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type));
|
|
53956
|
+
}
|
|
53957
|
+
function isReducibleIntersection(type) {
|
|
53958
|
+
const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
53959
|
+
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
53960
|
+
}
|
|
53960
53961
|
function elaborateNeverIntersection(errorInfo, type) {
|
|
53961
53962
|
if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) {
|
|
53962
53963
|
const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType);
|
|
@@ -54825,11 +54826,8 @@ function createTypeChecker(host) {
|
|
|
54825
54826
|
}
|
|
54826
54827
|
function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
|
|
54827
54828
|
const type = getDeclaredTypeOfSymbol(symbol);
|
|
54828
|
-
if (type === intrinsicMarkerType && typeArguments && typeArguments.length === 1) {
|
|
54829
|
-
|
|
54830
|
-
return getStringMappingType(symbol, typeArguments[0]);
|
|
54831
|
-
}
|
|
54832
|
-
return getNoInferType(symbol, typeArguments[0]);
|
|
54829
|
+
if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
|
|
54830
|
+
return getStringMappingType(symbol, typeArguments[0]);
|
|
54833
54831
|
}
|
|
54834
54832
|
const links = getSymbolLinks(symbol);
|
|
54835
54833
|
const typeParameters = links.typeParameters;
|
|
@@ -55733,7 +55731,7 @@ function createTypeChecker(host) {
|
|
|
55733
55731
|
const type = elementTypes[i];
|
|
55734
55732
|
const flags = target.elementFlags[i];
|
|
55735
55733
|
if (flags & 8 /* Variadic */) {
|
|
55736
|
-
if (type.flags &
|
|
55734
|
+
if (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
|
|
55737
55735
|
addElement(type, 8 /* Variadic */, (_a2 = target.labeledElementDeclarations) == null ? void 0 : _a2[i]);
|
|
55738
55736
|
} else if (isTupleType(type)) {
|
|
55739
55737
|
const elements = getTypeArguments(type);
|
|
@@ -55842,7 +55840,7 @@ function createTypeChecker(host) {
|
|
|
55842
55840
|
}
|
|
55843
55841
|
if (!(flags & 131072 /* Never */)) {
|
|
55844
55842
|
includes |= flags & 473694207 /* IncludesMask */;
|
|
55845
|
-
if (flags &
|
|
55843
|
+
if (flags & 465829888 /* Instantiable */)
|
|
55846
55844
|
includes |= 33554432 /* IncludesInstantiable */;
|
|
55847
55845
|
if (type === wildcardType)
|
|
55848
55846
|
includes |= 8388608 /* IncludesWildcard */;
|
|
@@ -55882,8 +55880,8 @@ function createTypeChecker(host) {
|
|
|
55882
55880
|
while (i > 0) {
|
|
55883
55881
|
i--;
|
|
55884
55882
|
const source = types[i];
|
|
55885
|
-
if (hasEmptyObject || source.flags &
|
|
55886
|
-
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
55883
|
+
if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
55884
|
+
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
|
|
55887
55885
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
55888
55886
|
for (const target of types) {
|
|
55889
55887
|
if (source !== target) {
|
|
@@ -55896,7 +55894,7 @@ function createTypeChecker(host) {
|
|
|
55896
55894
|
}
|
|
55897
55895
|
}
|
|
55898
55896
|
count++;
|
|
55899
|
-
if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
55897
|
+
if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
55900
55898
|
const t = getTypeOfPropertyOfType(target, keyProperty.escapedName);
|
|
55901
55899
|
if (t && isUnitType(t) && getRegularTypeOfLiteralType(t) !== keyPropertyType) {
|
|
55902
55900
|
continue;
|
|
@@ -56329,10 +56327,10 @@ function createTypeChecker(host) {
|
|
|
56329
56327
|
}
|
|
56330
56328
|
return links.resolvedType;
|
|
56331
56329
|
}
|
|
56332
|
-
function createIndexType(type,
|
|
56330
|
+
function createIndexType(type, indexFlags) {
|
|
56333
56331
|
const result = createType(4194304 /* Index */);
|
|
56334
56332
|
result.type = type;
|
|
56335
|
-
result.
|
|
56333
|
+
result.indexFlags = indexFlags;
|
|
56336
56334
|
return result;
|
|
56337
56335
|
}
|
|
56338
56336
|
function createOriginIndexType(type) {
|
|
@@ -56340,31 +56338,23 @@ function createTypeChecker(host) {
|
|
|
56340
56338
|
result.type = type;
|
|
56341
56339
|
return result;
|
|
56342
56340
|
}
|
|
56343
|
-
function getIndexTypeForGenericType(type,
|
|
56344
|
-
return
|
|
56345
|
-
type,
|
|
56346
|
-
/*stringsOnly*/
|
|
56347
|
-
true
|
|
56348
|
-
)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(
|
|
56349
|
-
type,
|
|
56350
|
-
/*stringsOnly*/
|
|
56351
|
-
false
|
|
56352
|
-
));
|
|
56341
|
+
function getIndexTypeForGenericType(type, indexFlags) {
|
|
56342
|
+
return indexFlags & 1 /* StringsOnly */ ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, 1 /* StringsOnly */)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, 0 /* None */));
|
|
56353
56343
|
}
|
|
56354
|
-
function getIndexTypeForMappedType(type,
|
|
56344
|
+
function getIndexTypeForMappedType(type, indexFlags) {
|
|
56355
56345
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
56356
56346
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
56357
56347
|
const nameType = getNameTypeFromMappedType(type.target || type);
|
|
56358
|
-
if (!nameType && !
|
|
56348
|
+
if (!nameType && !(indexFlags & 2 /* NoIndexSignatures */)) {
|
|
56359
56349
|
return constraintType;
|
|
56360
56350
|
}
|
|
56361
56351
|
const keyTypes = [];
|
|
56362
56352
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
56363
56353
|
if (!isGenericIndexType(constraintType)) {
|
|
56364
56354
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
56365
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */,
|
|
56355
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
|
|
56366
56356
|
} else {
|
|
56367
|
-
return getIndexTypeForGenericType(type,
|
|
56357
|
+
return getIndexTypeForGenericType(type, indexFlags);
|
|
56368
56358
|
}
|
|
56369
56359
|
} else {
|
|
56370
56360
|
forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
|
|
@@ -56372,7 +56362,7 @@ function createTypeChecker(host) {
|
|
|
56372
56362
|
if (isGenericIndexType(constraintType)) {
|
|
56373
56363
|
forEachType(constraintType, addMemberForKeyType);
|
|
56374
56364
|
}
|
|
56375
|
-
const result =
|
|
56365
|
+
const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
|
|
56376
56366
|
if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
|
|
56377
56367
|
return constraintType;
|
|
56378
56368
|
}
|
|
@@ -56425,19 +56415,15 @@ function createTypeChecker(host) {
|
|
|
56425
56415
|
origin
|
|
56426
56416
|
);
|
|
56427
56417
|
}
|
|
56428
|
-
function
|
|
56429
|
-
|
|
56430
|
-
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
56418
|
+
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
56419
|
+
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
56431
56420
|
}
|
|
56432
|
-
function
|
|
56433
|
-
return !!(type.flags & 595853312 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 1002700800 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
56434
|
-
}
|
|
56435
|
-
function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) {
|
|
56421
|
+
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
56436
56422
|
type = getReducedType(type);
|
|
56437
|
-
return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type,
|
|
56423
|
+
return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(
|
|
56438
56424
|
type,
|
|
56439
|
-
(
|
|
56440
|
-
|
|
56425
|
+
(indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */),
|
|
56426
|
+
indexFlags === defaultIndexFlags
|
|
56441
56427
|
);
|
|
56442
56428
|
}
|
|
56443
56429
|
function getExtractStringType(type) {
|
|
@@ -56562,19 +56548,8 @@ function createTypeChecker(host) {
|
|
|
56562
56548
|
)
|
|
56563
56549
|
);
|
|
56564
56550
|
}
|
|
56565
|
-
function getNoInferType(symbol, type) {
|
|
56566
|
-
if (!isGenericType(type)) {
|
|
56567
|
-
return type;
|
|
56568
|
-
}
|
|
56569
|
-
const id = `${getSymbolId(symbol)},${getTypeId(type)}`;
|
|
56570
|
-
let result = intrinsicWrapperTypes.get(id);
|
|
56571
|
-
if (!result) {
|
|
56572
|
-
intrinsicWrapperTypes.set(id, result = createNoInferType(symbol, type));
|
|
56573
|
-
}
|
|
56574
|
-
return result;
|
|
56575
|
-
}
|
|
56576
56551
|
function applyStringMapping(symbol, str) {
|
|
56577
|
-
switch (
|
|
56552
|
+
switch (intrinsicTypeKinds.get(symbol.escapedName)) {
|
|
56578
56553
|
case 0 /* Uppercase */:
|
|
56579
56554
|
return str.toUpperCase();
|
|
56580
56555
|
case 1 /* Lowercase */:
|
|
@@ -56587,7 +56562,7 @@ function createTypeChecker(host) {
|
|
|
56587
56562
|
return str;
|
|
56588
56563
|
}
|
|
56589
56564
|
function applyTemplateStringMapping(symbol, texts, types) {
|
|
56590
|
-
switch (
|
|
56565
|
+
switch (intrinsicTypeKinds.get(symbol.escapedName)) {
|
|
56591
56566
|
case 0 /* Uppercase */:
|
|
56592
56567
|
return [texts.map((t) => t.toUpperCase()), types.map((t) => getStringMappingType(symbol, t))];
|
|
56593
56568
|
case 1 /* Lowercase */:
|
|
@@ -56601,9 +56576,9 @@ function createTypeChecker(host) {
|
|
|
56601
56576
|
}
|
|
56602
56577
|
function getStringMappingTypeForGenericType(symbol, type) {
|
|
56603
56578
|
const id = `${getSymbolId(symbol)},${getTypeId(type)}`;
|
|
56604
|
-
let result =
|
|
56579
|
+
let result = stringMappingTypes.get(id);
|
|
56605
56580
|
if (!result) {
|
|
56606
|
-
|
|
56581
|
+
stringMappingTypes.set(id, result = createStringMappingType(symbol, type));
|
|
56607
56582
|
}
|
|
56608
56583
|
return result;
|
|
56609
56584
|
}
|
|
@@ -56612,11 +56587,6 @@ function createTypeChecker(host) {
|
|
|
56612
56587
|
result.type = type;
|
|
56613
56588
|
return result;
|
|
56614
56589
|
}
|
|
56615
|
-
function createNoInferType(symbol, type) {
|
|
56616
|
-
const result = createTypeWithSymbol(536870912 /* NoInfer */, symbol);
|
|
56617
|
-
result.type = type;
|
|
56618
|
-
return result;
|
|
56619
|
-
}
|
|
56620
56590
|
function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) {
|
|
56621
56591
|
const type = createType(8388608 /* IndexedAccess */);
|
|
56622
56592
|
type.objectType = objectType;
|
|
@@ -56639,7 +56609,7 @@ function createTypeChecker(host) {
|
|
|
56639
56609
|
if (type.flags & 2097152 /* Intersection */) {
|
|
56640
56610
|
return some(type.types, isJSLiteralType);
|
|
56641
56611
|
}
|
|
56642
|
-
if (type.flags &
|
|
56612
|
+
if (type.flags & 465829888 /* Instantiable */) {
|
|
56643
56613
|
const constraint = getResolvedBaseConstraint(type);
|
|
56644
56614
|
return constraint !== type && isJSLiteralType(constraint);
|
|
56645
56615
|
}
|
|
@@ -56891,7 +56861,7 @@ function createTypeChecker(host) {
|
|
|
56891
56861
|
}
|
|
56892
56862
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
56893
56863
|
}
|
|
56894
|
-
return (type.flags &
|
|
56864
|
+
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);
|
|
56895
56865
|
}
|
|
56896
56866
|
function getSimplifiedType(type, writing) {
|
|
56897
56867
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -56920,7 +56890,7 @@ function createTypeChecker(host) {
|
|
|
56920
56890
|
if (distributedOverIndex) {
|
|
56921
56891
|
return type[cache] = distributedOverIndex;
|
|
56922
56892
|
}
|
|
56923
|
-
if (!(indexType.flags &
|
|
56893
|
+
if (!(indexType.flags & 465829888 /* Instantiable */)) {
|
|
56924
56894
|
const distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
|
|
56925
56895
|
if (distributedOverObject) {
|
|
56926
56896
|
return type[cache] = distributedOverObject;
|
|
@@ -56993,12 +56963,13 @@ function createTypeChecker(host) {
|
|
|
56993
56963
|
if (objectType === wildcardType || indexType === wildcardType) {
|
|
56994
56964
|
return wildcardType;
|
|
56995
56965
|
}
|
|
56966
|
+
objectType = getReducedType(objectType);
|
|
56996
56967
|
if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
|
|
56997
56968
|
indexType = stringType;
|
|
56998
56969
|
}
|
|
56999
56970
|
if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */)
|
|
57000
56971
|
accessFlags |= 1 /* IncludeUndefined */;
|
|
57001
|
-
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) {
|
|
56972
|
+
if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 197 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) {
|
|
57002
56973
|
if (objectType.flags & 3 /* AnyOrUnknown */) {
|
|
57003
56974
|
return objectType;
|
|
57004
56975
|
}
|
|
@@ -57971,7 +57942,7 @@ function createTypeChecker(host) {
|
|
|
57971
57942
|
const mappedTypeVariable = instantiateType(typeVariable, mapper);
|
|
57972
57943
|
if (typeVariable !== mappedTypeVariable) {
|
|
57973
57944
|
return mapTypeWithAlias(getReducedType(mappedTypeVariable), (t) => {
|
|
57974
|
-
if (t.flags & (3 /* AnyOrUnknown */ |
|
|
57945
|
+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
57975
57946
|
if (!type.declaration.nameType) {
|
|
57976
57947
|
let constraint;
|
|
57977
57948
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
@@ -58136,9 +58107,6 @@ function createTypeChecker(host) {
|
|
|
58136
58107
|
if (flags & 268435456 /* StringMapping */) {
|
|
58137
58108
|
return getStringMappingType(type.symbol, instantiateType(type.type, mapper));
|
|
58138
58109
|
}
|
|
58139
|
-
if (flags & 536870912 /* NoInfer */) {
|
|
58140
|
-
return getNoInferType(type.symbol, instantiateType(type.type, mapper));
|
|
58141
|
-
}
|
|
58142
58110
|
if (flags & 8388608 /* IndexedAccess */) {
|
|
58143
58111
|
const newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
58144
58112
|
const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
@@ -58187,9 +58155,6 @@ function createTypeChecker(host) {
|
|
|
58187
58155
|
}
|
|
58188
58156
|
return type;
|
|
58189
58157
|
}
|
|
58190
|
-
function getUniqueLiteralFilledInstantiation(type) {
|
|
58191
|
-
return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
58192
|
-
}
|
|
58193
58158
|
function getPermissiveInstantiation(type) {
|
|
58194
58159
|
return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
58195
58160
|
}
|
|
@@ -58288,7 +58253,7 @@ function createTypeChecker(host) {
|
|
|
58288
58253
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
58289
58254
|
}
|
|
58290
58255
|
function isTypeDerivedFrom(source, target) {
|
|
58291
|
-
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 &
|
|
58256
|
+
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);
|
|
58292
58257
|
}
|
|
58293
58258
|
function isTypeComparableTo(source, target) {
|
|
58294
58259
|
return isTypeRelatedTo(source, target, comparableRelation);
|
|
@@ -58901,7 +58866,12 @@ function createTypeChecker(host) {
|
|
|
58901
58866
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
58902
58867
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
58903
58868
|
for (let i = 0; i < paramCount; i++) {
|
|
58904
|
-
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
58869
|
+
const sourceType = i === restIndex ? getRestTypeAtPosition(
|
|
58870
|
+
source,
|
|
58871
|
+
i,
|
|
58872
|
+
/*readonly*/
|
|
58873
|
+
true
|
|
58874
|
+
) : tryGetTypeAtPosition(source, i);
|
|
58905
58875
|
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
58906
58876
|
if (sourceType && targetType) {
|
|
58907
58877
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
@@ -59151,7 +59121,7 @@ function createTypeChecker(host) {
|
|
|
59151
59121
|
return !!(related & 1 /* Succeeded */);
|
|
59152
59122
|
}
|
|
59153
59123
|
}
|
|
59154
|
-
if (source.flags &
|
|
59124
|
+
if (source.flags & 469499904 /* StructuredOrInstantiable */ || target.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
59155
59125
|
return checkTypeRelatedTo(
|
|
59156
59126
|
source,
|
|
59157
59127
|
target,
|
|
@@ -59167,7 +59137,7 @@ function createTypeChecker(host) {
|
|
|
59167
59137
|
}
|
|
59168
59138
|
function getNormalizedType(type, writing) {
|
|
59169
59139
|
while (true) {
|
|
59170
|
-
const t = isFreshLiteralType(type) ? type.regularType : 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
|
|
59140
|
+
const t = isFreshLiteralType(type) ? type.regularType : 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;
|
|
59171
59141
|
if (t === type)
|
|
59172
59142
|
return t;
|
|
59173
59143
|
type = t;
|
|
@@ -59525,7 +59495,7 @@ function createTypeChecker(host) {
|
|
|
59525
59495
|
}
|
|
59526
59496
|
if (relation === comparableRelation && !(target2.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(target2, source2, relation) || isSimpleTypeRelatedTo(source2, target2, relation, reportErrors2 ? reportError : void 0))
|
|
59527
59497
|
return -1 /* True */;
|
|
59528
|
-
if (source2.flags &
|
|
59498
|
+
if (source2.flags & 469499904 /* StructuredOrInstantiable */ || target2.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
59529
59499
|
const isPerformingExcessPropertyChecks = !(intersectionState & 2 /* Target */) && (isObjectLiteralType(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */);
|
|
59530
59500
|
if (isPerformingExcessPropertyChecks) {
|
|
59531
59501
|
if (hasExcessProperties(source2, target2, reportErrors2)) {
|
|
@@ -59564,7 +59534,7 @@ function createTypeChecker(host) {
|
|
|
59564
59534
|
return 0 /* False */;
|
|
59565
59535
|
}
|
|
59566
59536
|
traceUnionsOrIntersectionsTooLarge(source2, target2);
|
|
59567
|
-
const skipCaching = source2.flags & 1048576 /* Union */ && source2.types.length < 4 && !(target2.flags & 1048576 /* Union */) || target2.flags & 1048576 /* Union */ && target2.types.length < 4 && !(source2.flags &
|
|
59537
|
+
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 */);
|
|
59568
59538
|
const result2 = skipCaching ? unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) : recursiveTypeRelatedTo(source2, target2, reportErrors2, intersectionState, recursionFlags);
|
|
59569
59539
|
if (result2) {
|
|
59570
59540
|
return result2;
|
|
@@ -59752,7 +59722,7 @@ function createTypeChecker(host) {
|
|
|
59752
59722
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
59753
59723
|
}
|
|
59754
59724
|
if (relation === comparableRelation && target2.flags & 402784252 /* Primitive */) {
|
|
59755
|
-
const constraints = sameMap(source2.types, (t) => t.flags &
|
|
59725
|
+
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
59756
59726
|
if (constraints !== source2.types) {
|
|
59757
59727
|
source2 = getIntersectionType(constraints);
|
|
59758
59728
|
if (source2.flags & 131072 /* Never */) {
|
|
@@ -60303,7 +60273,7 @@ function createTypeChecker(host) {
|
|
|
60303
60273
|
if (result2 = unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState)) {
|
|
60304
60274
|
return result2;
|
|
60305
60275
|
}
|
|
60306
|
-
if (!(sourceFlags &
|
|
60276
|
+
if (!(sourceFlags & 465829888 /* Instantiable */ || sourceFlags & 524288 /* Object */ && targetFlags & 1048576 /* Union */ || sourceFlags & 2097152 /* Intersection */ && targetFlags & (524288 /* Object */ | 1048576 /* Union */ | 465829888 /* Instantiable */))) {
|
|
60307
60277
|
return 0 /* False */;
|
|
60308
60278
|
}
|
|
60309
60279
|
}
|
|
@@ -60372,7 +60342,7 @@ function createTypeChecker(host) {
|
|
|
60372
60342
|
} else {
|
|
60373
60343
|
const constraint = getSimplifiedTypeOrConstraint(targetType);
|
|
60374
60344
|
if (constraint) {
|
|
60375
|
-
if (isRelatedTo(source2, getIndexType(constraint, target2.
|
|
60345
|
+
if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) {
|
|
60376
60346
|
return -1 /* True */;
|
|
60377
60347
|
}
|
|
60378
60348
|
} else if (isGenericMappedType(targetType)) {
|
|
@@ -60453,13 +60423,7 @@ function createTypeChecker(host) {
|
|
|
60453
60423
|
}
|
|
60454
60424
|
if (!isGenericMappedType(source2)) {
|
|
60455
60425
|
const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2);
|
|
60456
|
-
const sourceKeys = getIndexType(
|
|
60457
|
-
source2,
|
|
60458
|
-
/*stringsOnly*/
|
|
60459
|
-
void 0,
|
|
60460
|
-
/*noIndexSignatures*/
|
|
60461
|
-
true
|
|
60462
|
-
);
|
|
60426
|
+
const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */);
|
|
60463
60427
|
const includeOptional = modifiers & 4 /* IncludeOptional */;
|
|
60464
60428
|
const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0;
|
|
60465
60429
|
if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) {
|
|
@@ -61494,7 +61458,7 @@ function createTypeChecker(host) {
|
|
|
61494
61458
|
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
61495
61459
|
return !!forEach(type.types, typeCouldHaveTopLevelSingletonTypes);
|
|
61496
61460
|
}
|
|
61497
|
-
if (type.flags &
|
|
61461
|
+
if (type.flags & 465829888 /* Instantiable */) {
|
|
61498
61462
|
const constraint = getConstraintOfType(type);
|
|
61499
61463
|
if (constraint && constraint !== type) {
|
|
61500
61464
|
return typeCouldHaveTopLevelSingletonTypes(constraint);
|
|
@@ -62543,7 +62507,7 @@ function createTypeChecker(host) {
|
|
|
62543
62507
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
62544
62508
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
62545
62509
|
}
|
|
62546
|
-
const result = !!(type.flags &
|
|
62510
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || forEach(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));
|
|
62547
62511
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
62548
62512
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
62549
62513
|
}
|
|
@@ -62825,7 +62789,7 @@ function createTypeChecker(host) {
|
|
|
62825
62789
|
let expandingFlags = 0 /* None */;
|
|
62826
62790
|
inferFromTypes(originalSource, originalTarget);
|
|
62827
62791
|
function inferFromTypes(source, target) {
|
|
62828
|
-
if (!couldContainTypeVariables(target)
|
|
62792
|
+
if (!couldContainTypeVariables(target)) {
|
|
62829
62793
|
return;
|
|
62830
62794
|
}
|
|
62831
62795
|
if (source === wildcardType) {
|
|
@@ -62924,7 +62888,7 @@ function createTypeChecker(host) {
|
|
|
62924
62888
|
/*writing*/
|
|
62925
62889
|
false
|
|
62926
62890
|
);
|
|
62927
|
-
if (indexType.flags &
|
|
62891
|
+
if (indexType.flags & 465829888 /* Instantiable */) {
|
|
62928
62892
|
const simplified2 = distributeIndexOverObjectType(
|
|
62929
62893
|
getSimplifiedType(
|
|
62930
62894
|
target.objectType,
|
|
@@ -62971,7 +62935,7 @@ function createTypeChecker(host) {
|
|
|
62971
62935
|
inferToTemplateLiteralType(source, target);
|
|
62972
62936
|
} else {
|
|
62973
62937
|
source = getReducedType(source);
|
|
62974
|
-
if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ |
|
|
62938
|
+
if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */))) {
|
|
62975
62939
|
const apparentSource = getApparentType(source);
|
|
62976
62940
|
if (apparentSource !== source && allowComplexConstraintInference && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
|
|
62977
62941
|
allowComplexConstraintInference = false;
|
|
@@ -63723,7 +63687,7 @@ function createTypeChecker(host) {
|
|
|
63723
63687
|
const map2 = /* @__PURE__ */ new Map();
|
|
63724
63688
|
let count = 0;
|
|
63725
63689
|
for (const type of types) {
|
|
63726
|
-
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
63690
|
+
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
63727
63691
|
const discriminant = getTypeOfPropertyOfType(type, name);
|
|
63728
63692
|
if (discriminant) {
|
|
63729
63693
|
if (!isLiteralType(discriminant)) {
|
|
@@ -63749,11 +63713,11 @@ function createTypeChecker(host) {
|
|
|
63749
63713
|
}
|
|
63750
63714
|
function getKeyPropertyName(unionType) {
|
|
63751
63715
|
const types = unionType.types;
|
|
63752
|
-
if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ |
|
|
63716
|
+
if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */))) < 10) {
|
|
63753
63717
|
return void 0;
|
|
63754
63718
|
}
|
|
63755
63719
|
if (unionType.keyPropertyName === void 0) {
|
|
63756
|
-
const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ |
|
|
63720
|
+
const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */) ? forEach(getPropertiesOfType(t), (p) => isUnitType(getTypeOfSymbol(p)) ? p.escapedName : void 0) : void 0);
|
|
63757
63721
|
const mapByKeyProperty = keyPropertyName && mapTypesByKeyProperty(types, keyPropertyName);
|
|
63758
63722
|
unionType.keyPropertyName = mapByKeyProperty ? keyPropertyName : "";
|
|
63759
63723
|
unionType.constituentMap = mapByKeyProperty;
|
|
@@ -63831,7 +63795,7 @@ function createTypeChecker(host) {
|
|
|
63831
63795
|
return !!(resolved.callSignatures.length || resolved.constructSignatures.length || resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType));
|
|
63832
63796
|
}
|
|
63833
63797
|
function getTypeFacts(type) {
|
|
63834
|
-
if (type.flags & (2097152 /* Intersection */ |
|
|
63798
|
+
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
63835
63799
|
type = getBaseConstraintOfType(type) || unknownType;
|
|
63836
63800
|
}
|
|
63837
63801
|
const flags = type.flags;
|
|
@@ -65376,7 +65340,7 @@ function createTypeChecker(host) {
|
|
|
65376
65340
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
65377
65341
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
65378
65342
|
const directlyRelated = mapType(matching || type, 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);
|
|
65379
|
-
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t,
|
|
65343
|
+
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
65380
65344
|
});
|
|
65381
65345
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
65382
65346
|
}
|
|
@@ -65556,10 +65520,10 @@ function createTypeChecker(host) {
|
|
|
65556
65520
|
return parent.kind === 209 /* PropertyAccessExpression */ || parent.kind === 164 /* QualifiedName */ || parent.kind === 211 /* CallExpression */ && parent.expression === node || parent.kind === 210 /* ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
|
|
65557
65521
|
}
|
|
65558
65522
|
function isGenericTypeWithUnionConstraint(type) {
|
|
65559
|
-
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags &
|
|
65523
|
+
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
|
|
65560
65524
|
}
|
|
65561
65525
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
65562
|
-
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags &
|
|
65526
|
+
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
65563
65527
|
}
|
|
65564
65528
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
65565
65529
|
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 64 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
|
|
@@ -66867,7 +66831,7 @@ function createTypeChecker(host) {
|
|
|
66867
66831
|
}
|
|
66868
66832
|
}
|
|
66869
66833
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
66870
|
-
if (contextualType && maybeTypeOfKind(contextualType,
|
|
66834
|
+
if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* Instantiable */)) {
|
|
66871
66835
|
const inferenceContext = getInferenceContext(node);
|
|
66872
66836
|
if (inferenceContext && contextFlags & 1 /* Signature */ && some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
|
|
66873
66837
|
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
@@ -66880,7 +66844,7 @@ function createTypeChecker(host) {
|
|
|
66880
66844
|
return contextualType;
|
|
66881
66845
|
}
|
|
66882
66846
|
function instantiateInstantiableTypes(type, mapper) {
|
|
66883
|
-
if (type.flags &
|
|
66847
|
+
if (type.flags & 465829888 /* Instantiable */) {
|
|
66884
66848
|
return instantiateType(type, mapper);
|
|
66885
66849
|
}
|
|
66886
66850
|
if (type.flags & 1048576 /* Union */) {
|
|
@@ -67654,7 +67618,7 @@ function createTypeChecker(host) {
|
|
|
67654
67618
|
}
|
|
67655
67619
|
function isValidSpreadType(type) {
|
|
67656
67620
|
const t = removeDefinitelyFalsyTypes(mapType(type, getBaseConstraintOrType));
|
|
67657
|
-
return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ |
|
|
67621
|
+
return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */) || t.flags & 3145728 /* UnionOrIntersection */ && every(t.types, isValidSpreadType));
|
|
67658
67622
|
}
|
|
67659
67623
|
function checkJsxSelfClosingElementDeferred(node) {
|
|
67660
67624
|
checkJsxOpeningLikeElementOrOpeningFragment(node);
|
|
@@ -71208,7 +71172,7 @@ function createTypeChecker(host) {
|
|
|
71208
71172
|
result3.node = node;
|
|
71209
71173
|
return result3;
|
|
71210
71174
|
}
|
|
71211
|
-
} else if (type2.flags &
|
|
71175
|
+
} else if (type2.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
71212
71176
|
const constraint = getBaseConstraintOfType(type2);
|
|
71213
71177
|
if (constraint) {
|
|
71214
71178
|
const instantiated = getInstantiatedTypePart(constraint);
|
|
@@ -71392,12 +71356,12 @@ function createTypeChecker(host) {
|
|
|
71392
71356
|
}
|
|
71393
71357
|
return void 0;
|
|
71394
71358
|
}
|
|
71395
|
-
function getRestTypeAtPosition(source, pos) {
|
|
71359
|
+
function getRestTypeAtPosition(source, pos, readonly = false) {
|
|
71396
71360
|
const parameterCount = getParameterCount(source);
|
|
71397
71361
|
const minArgumentCount = getMinArgumentCount(source);
|
|
71398
71362
|
const restType = getEffectiveRestType(source);
|
|
71399
71363
|
if (restType && pos >= parameterCount - 1) {
|
|
71400
|
-
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType));
|
|
71364
|
+
return pos === parameterCount - 1 ? restType : createArrayType(getIndexedAccessType(restType, numberType), readonly);
|
|
71401
71365
|
}
|
|
71402
71366
|
const types = [];
|
|
71403
71367
|
const flags = [];
|
|
@@ -71415,13 +71379,7 @@ function createTypeChecker(host) {
|
|
|
71415
71379
|
names.push(name);
|
|
71416
71380
|
}
|
|
71417
71381
|
}
|
|
71418
|
-
return createTupleType(
|
|
71419
|
-
types,
|
|
71420
|
-
flags,
|
|
71421
|
-
/*readonly*/
|
|
71422
|
-
false,
|
|
71423
|
-
length(names) === length(types) ? names : void 0
|
|
71424
|
-
);
|
|
71382
|
+
return createTupleType(types, flags, readonly, length(names) === length(types) ? names : void 0);
|
|
71425
71383
|
}
|
|
71426
71384
|
function getParameterCount(signature) {
|
|
71427
71385
|
const length2 = signature.parameters.length;
|
|
@@ -73481,7 +73439,7 @@ function createTypeChecker(host) {
|
|
|
73481
73439
|
) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
|
|
73482
73440
|
}
|
|
73483
73441
|
function isTemplateLiteralContextualType(type) {
|
|
73484
|
-
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags &
|
|
73442
|
+
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
73485
73443
|
}
|
|
73486
73444
|
function getContextNode(node) {
|
|
73487
73445
|
if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
|
|
@@ -73594,7 +73552,7 @@ function createTypeChecker(host) {
|
|
|
73594
73552
|
const types = contextualType.types;
|
|
73595
73553
|
return some(types, (t) => isLiteralOfContextualType(candidateType, t));
|
|
73596
73554
|
}
|
|
73597
|
-
if (contextualType.flags &
|
|
73555
|
+
if (contextualType.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
73598
73556
|
const constraint = getBaseConstraintOfType(contextualType) || unknownType;
|
|
73599
73557
|
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);
|
|
73600
73558
|
}
|
|
@@ -74699,11 +74657,7 @@ function createTypeChecker(host) {
|
|
|
74699
74657
|
}
|
|
74700
74658
|
const objectType = type.objectType;
|
|
74701
74659
|
const indexType = type.indexType;
|
|
74702
|
-
if (isTypeAssignableTo(indexType, getIndexType(
|
|
74703
|
-
objectType,
|
|
74704
|
-
/*stringsOnly*/
|
|
74705
|
-
false
|
|
74706
|
-
))) {
|
|
74660
|
+
if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) {
|
|
74707
74661
|
if (accessNode.kind === 210 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
74708
74662
|
error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
74709
74663
|
}
|
|
@@ -76652,7 +76606,7 @@ function createTypeChecker(host) {
|
|
|
76652
76606
|
);
|
|
76653
76607
|
}
|
|
76654
76608
|
}
|
|
76655
|
-
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ |
|
|
76609
|
+
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
76656
76610
|
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));
|
|
76657
76611
|
}
|
|
76658
76612
|
checkSourceElement(node.statement);
|
|
@@ -78329,7 +78283,7 @@ function createTypeChecker(host) {
|
|
|
78329
78283
|
checkExportsOnMergedDeclarations(node);
|
|
78330
78284
|
checkTypeParameters(node.typeParameters);
|
|
78331
78285
|
if (node.type.kind === 140 /* IntrinsicKeyword */) {
|
|
78332
|
-
if (!
|
|
78286
|
+
if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) {
|
|
78333
78287
|
error(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
|
|
78334
78288
|
}
|
|
78335
78289
|
} else {
|
|
@@ -81523,7 +81477,8 @@ function createTypeChecker(host) {
|
|
|
81523
81477
|
return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
|
|
81524
81478
|
}
|
|
81525
81479
|
if (!(node.parent.kind === 261 /* ClassDeclaration */ && hasSyntacticModifier(node.parent, 256 /* Abstract */))) {
|
|
81526
|
-
|
|
81480
|
+
const message = node.kind === 170 /* PropertyDeclaration */ ? Diagnostics.Abstract_properties_can_only_appear_within_an_abstract_class : Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class;
|
|
81481
|
+
return grammarErrorOnNode(modifier, message);
|
|
81527
81482
|
}
|
|
81528
81483
|
if (flags & 32 /* Static */) {
|
|
81529
81484
|
return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract");
|