typescript 5.6.0-dev.20240819 → 5.7.0-dev.20240820
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/tsc.js +92 -30
- package/lib/typesMap.json +497 -497
- package/lib/typescript.d.ts +22 -1
- package/lib/typescript.js +227 -70
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -17,8 +17,8 @@ and limitations under the License.
|
|
|
17
17
|
"use strict";
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
|
-
var versionMajorMinor = "5.
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
20
|
+
var versionMajorMinor = "5.7";
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240820`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -71370,46 +71370,108 @@ function createTypeChecker(host) {
|
|
|
71370
71370
|
function isCircularMappedProperty(symbol) {
|
|
71371
71371
|
return !!(getCheckFlags(symbol) & 262144 /* Mapped */ && !symbol.links.type && findResolutionCycleStartIndex(symbol, 0 /* Type */) >= 0);
|
|
71372
71372
|
}
|
|
71373
|
+
function isExcludedMappedPropertyName(constraint, propertyNameType) {
|
|
71374
|
+
if (constraint.flags & 16777216 /* Conditional */) {
|
|
71375
|
+
const type = constraint;
|
|
71376
|
+
return !!(getReducedType(getTrueTypeFromConditionalType(type)).flags & 131072 /* Never */) && getActualTypeVariable(getFalseTypeFromConditionalType(type)) === getActualTypeVariable(type.checkType) && isTypeAssignableTo(propertyNameType, type.extendsType);
|
|
71377
|
+
}
|
|
71378
|
+
if (constraint.flags & 2097152 /* Intersection */) {
|
|
71379
|
+
return some(constraint.types, (t) => isExcludedMappedPropertyName(t, propertyNameType));
|
|
71380
|
+
}
|
|
71381
|
+
return false;
|
|
71382
|
+
}
|
|
71373
71383
|
function getTypeOfPropertyOfContextualType(type, name, nameType) {
|
|
71374
71384
|
return mapType(
|
|
71375
71385
|
type,
|
|
71376
71386
|
(t) => {
|
|
71377
|
-
|
|
71378
|
-
|
|
71379
|
-
|
|
71380
|
-
|
|
71381
|
-
const
|
|
71382
|
-
|
|
71383
|
-
|
|
71384
|
-
|
|
71385
|
-
|
|
71386
|
-
|
|
71387
|
-
|
|
71388
|
-
|
|
71389
|
-
|
|
71390
|
-
|
|
71391
|
-
|
|
71392
|
-
|
|
71393
|
-
|
|
71394
|
-
|
|
71395
|
-
|
|
71396
|
-
/*writing*/
|
|
71397
|
-
false,
|
|
71398
|
-
/*noReductions*/
|
|
71399
|
-
true
|
|
71400
|
-
);
|
|
71401
|
-
if (restType) {
|
|
71402
|
-
return restType;
|
|
71387
|
+
if (t.flags & 2097152 /* Intersection */) {
|
|
71388
|
+
let types;
|
|
71389
|
+
let indexInfoCandidates;
|
|
71390
|
+
let ignoreIndexInfos = false;
|
|
71391
|
+
for (const constituentType of t.types) {
|
|
71392
|
+
if (!(constituentType.flags & 524288 /* Object */)) {
|
|
71393
|
+
continue;
|
|
71394
|
+
}
|
|
71395
|
+
if (isGenericMappedType(constituentType) && getMappedTypeNameTypeKind(constituentType) !== 2 /* Remapping */) {
|
|
71396
|
+
const substitutedType = getIndexedMappedTypeSubstitutedTypeOfContextualType(constituentType, name, nameType);
|
|
71397
|
+
types = appendContextualPropertyTypeConstituent(types, substitutedType);
|
|
71398
|
+
continue;
|
|
71399
|
+
}
|
|
71400
|
+
const propertyType = getTypeOfConcretePropertyOfContextualType(constituentType, name);
|
|
71401
|
+
if (!propertyType) {
|
|
71402
|
+
if (!ignoreIndexInfos) {
|
|
71403
|
+
indexInfoCandidates = append(indexInfoCandidates, constituentType);
|
|
71404
|
+
}
|
|
71405
|
+
continue;
|
|
71403
71406
|
}
|
|
71407
|
+
ignoreIndexInfos = true;
|
|
71408
|
+
indexInfoCandidates = void 0;
|
|
71409
|
+
types = appendContextualPropertyTypeConstituent(types, propertyType);
|
|
71410
|
+
}
|
|
71411
|
+
if (indexInfoCandidates) {
|
|
71412
|
+
for (const candidate of indexInfoCandidates) {
|
|
71413
|
+
const indexInfoType = getTypeFromIndexInfosOfContextualType(candidate, name, nameType);
|
|
71414
|
+
types = appendContextualPropertyTypeConstituent(types, indexInfoType);
|
|
71415
|
+
}
|
|
71416
|
+
}
|
|
71417
|
+
if (!types) {
|
|
71418
|
+
return;
|
|
71404
71419
|
}
|
|
71405
|
-
|
|
71420
|
+
if (types.length === 1) {
|
|
71421
|
+
return types[0];
|
|
71422
|
+
}
|
|
71423
|
+
return getIntersectionType(types);
|
|
71406
71424
|
}
|
|
71407
|
-
|
|
71425
|
+
if (!(t.flags & 524288 /* Object */)) {
|
|
71426
|
+
return;
|
|
71427
|
+
}
|
|
71428
|
+
return isGenericMappedType(t) && getMappedTypeNameTypeKind(t) !== 2 /* Remapping */ ? getIndexedMappedTypeSubstitutedTypeOfContextualType(t, name, nameType) : getTypeOfConcretePropertyOfContextualType(t, name) ?? getTypeFromIndexInfosOfContextualType(t, name, nameType);
|
|
71408
71429
|
},
|
|
71409
71430
|
/*noReductions*/
|
|
71410
71431
|
true
|
|
71411
71432
|
);
|
|
71412
71433
|
}
|
|
71434
|
+
function appendContextualPropertyTypeConstituent(types, type) {
|
|
71435
|
+
return type ? append(types, type.flags & 1 /* Any */ ? unknownType : type) : types;
|
|
71436
|
+
}
|
|
71437
|
+
function getIndexedMappedTypeSubstitutedTypeOfContextualType(type, name, nameType) {
|
|
71438
|
+
const propertyNameType = nameType || getStringLiteralType(unescapeLeadingUnderscores(name));
|
|
71439
|
+
const constraint = getConstraintTypeFromMappedType(type);
|
|
71440
|
+
if (type.nameType && isExcludedMappedPropertyName(type.nameType, propertyNameType) || isExcludedMappedPropertyName(constraint, propertyNameType)) {
|
|
71441
|
+
return;
|
|
71442
|
+
}
|
|
71443
|
+
const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint;
|
|
71444
|
+
if (!isTypeAssignableTo(propertyNameType, constraintOfConstraint)) {
|
|
71445
|
+
return;
|
|
71446
|
+
}
|
|
71447
|
+
return substituteIndexedMappedType(type, propertyNameType);
|
|
71448
|
+
}
|
|
71449
|
+
function getTypeOfConcretePropertyOfContextualType(type, name) {
|
|
71450
|
+
const prop = getPropertyOfType(type, name);
|
|
71451
|
+
if (!prop || isCircularMappedProperty(prop)) {
|
|
71452
|
+
return;
|
|
71453
|
+
}
|
|
71454
|
+
return removeMissingType(getTypeOfSymbol(prop), !!(prop.flags & 16777216 /* Optional */));
|
|
71455
|
+
}
|
|
71456
|
+
function getTypeFromIndexInfosOfContextualType(type, name, nameType) {
|
|
71457
|
+
var _a;
|
|
71458
|
+
if (isTupleType(type) && isNumericLiteralName(name) && +name >= 0) {
|
|
71459
|
+
const restType = getElementTypeOfSliceOfTupleType(
|
|
71460
|
+
type,
|
|
71461
|
+
type.target.fixedLength,
|
|
71462
|
+
/*endSkipCount*/
|
|
71463
|
+
0,
|
|
71464
|
+
/*writing*/
|
|
71465
|
+
false,
|
|
71466
|
+
/*noReductions*/
|
|
71467
|
+
true
|
|
71468
|
+
);
|
|
71469
|
+
if (restType) {
|
|
71470
|
+
return restType;
|
|
71471
|
+
}
|
|
71472
|
+
}
|
|
71473
|
+
return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(type), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type;
|
|
71474
|
+
}
|
|
71413
71475
|
function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
|
|
71414
71476
|
Debug.assert(isObjectLiteralMethod(node));
|
|
71415
71477
|
if (node.flags & 67108864 /* InWithStatement */) {
|