@typescript-deploys/pr-build 5.4.0-pr-56742-5 → 5.4.0-pr-56652-11
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 +45 -35
- package/lib/tsserver.js +46 -36
- package/lib/typescript.js +46 -36
- package/lib/typingsInstaller.js +2 -2
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20231212`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3662,7 +3662,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3662
3662
|
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
|
|
3663
3663
|
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
|
|
3664
3664
|
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
|
|
3665
|
-
TypeFlags2[TypeFlags2["Simplifiable"] =
|
|
3665
|
+
TypeFlags2[TypeFlags2["Simplifiable"] = 29360128] = "Simplifiable";
|
|
3666
3666
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
3667
3667
|
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
|
|
3668
3668
|
TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask";
|
|
@@ -57815,7 +57815,7 @@ function createTypeChecker(host) {
|
|
|
57815
57815
|
);
|
|
57816
57816
|
}
|
|
57817
57817
|
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
57818
|
-
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 */)
|
|
57818
|
+
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 */));
|
|
57819
57819
|
}
|
|
57820
57820
|
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
57821
57821
|
type = getReducedType(type);
|
|
@@ -58254,10 +58254,10 @@ function createTypeChecker(host) {
|
|
|
58254
58254
|
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);
|
|
58255
58255
|
}
|
|
58256
58256
|
function getSimplifiedType(type, writing) {
|
|
58257
|
-
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
58257
|
+
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type.flags & 4194304 /* Index */ ? getSimplifiedIndexType(type) : type;
|
|
58258
58258
|
}
|
|
58259
58259
|
function distributeIndexOverObjectType(objectType, indexType, writing) {
|
|
58260
|
-
if (objectType.flags & 1048576 /* Union */ || objectType.flags & 2097152 /* Intersection */ && !
|
|
58260
|
+
if (objectType.flags & 1048576 /* Union */ || objectType.flags & 2097152 /* Intersection */ && !(maybeTypeOfKind(objectType, 465829888 /* Instantiable */) && some(objectType.types, isEmptyAnonymousObjectType))) {
|
|
58261
58261
|
const types = map(objectType.types, (t) => getSimplifiedType(getIndexedAccessType(t, indexType), writing));
|
|
58262
58262
|
return objectType.flags & 2097152 /* Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
|
|
58263
58263
|
}
|
|
@@ -58325,6 +58325,10 @@ function createTypeChecker(host) {
|
|
|
58325
58325
|
}
|
|
58326
58326
|
return type;
|
|
58327
58327
|
}
|
|
58328
|
+
function getSimplifiedIndexType(type) {
|
|
58329
|
+
const target = type.type;
|
|
58330
|
+
return target.flags & 2097152 /* Intersection */ && !some(target.types, isEmptyAnonymousObjectType) ? getUnionType(map(target.types, (t) => getIndexType(t, type.indexFlags))) : type;
|
|
58331
|
+
}
|
|
58328
58332
|
function isIntersectionEmpty(type1, type2) {
|
|
58329
58333
|
return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
|
|
58330
58334
|
}
|
|
@@ -60585,7 +60589,7 @@ function createTypeChecker(host) {
|
|
|
60585
60589
|
}
|
|
60586
60590
|
function getNormalizedType(type, writing) {
|
|
60587
60591
|
while (true) {
|
|
60588
|
-
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 &
|
|
60592
|
+
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 & 29360128 /* Simplifiable */ ? getSimplifiedType(type, writing) : type;
|
|
60589
60593
|
if (t === type)
|
|
60590
60594
|
return t;
|
|
60591
60595
|
type = t;
|
|
@@ -60606,7 +60610,7 @@ function createTypeChecker(host) {
|
|
|
60606
60610
|
}
|
|
60607
60611
|
function getNormalizedTupleType(type, writing) {
|
|
60608
60612
|
const elements = getElementTypes(type);
|
|
60609
|
-
const normalizedElements = sameMap(elements, (t) => t.flags &
|
|
60613
|
+
const normalizedElements = sameMap(elements, (t) => t.flags & 29360128 /* Simplifiable */ ? getSimplifiedType(t, writing) : t);
|
|
60610
60614
|
return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type;
|
|
60611
60615
|
}
|
|
60612
60616
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
@@ -61689,18 +61693,6 @@ function createTypeChecker(host) {
|
|
|
61689
61693
|
}
|
|
61690
61694
|
return result2;
|
|
61691
61695
|
}
|
|
61692
|
-
function getApparentMappedTypeKeys(nameType, targetType) {
|
|
61693
|
-
const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType));
|
|
61694
|
-
const mappedKeys = [];
|
|
61695
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
|
|
61696
|
-
modifiersType,
|
|
61697
|
-
8576 /* StringOrNumberLiteralOrUnique */,
|
|
61698
|
-
/*stringsOnly*/
|
|
61699
|
-
false,
|
|
61700
|
-
(t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
|
|
61701
|
-
);
|
|
61702
|
-
return getUnionType(mappedKeys);
|
|
61703
|
-
}
|
|
61704
61696
|
function structuredTypeRelatedToWorker(source2, target2, reportErrors2, intersectionState, saveErrorInfo) {
|
|
61705
61697
|
let result2;
|
|
61706
61698
|
let originalErrorInfo;
|
|
@@ -61883,8 +61875,16 @@ function createTypeChecker(host) {
|
|
|
61883
61875
|
const constraintType = getConstraintTypeFromMappedType(targetType);
|
|
61884
61876
|
let targetKeys;
|
|
61885
61877
|
if (nameType && isMappedTypeWithKeyofConstraintDeclaration(targetType)) {
|
|
61886
|
-
const
|
|
61887
|
-
|
|
61878
|
+
const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType));
|
|
61879
|
+
const mappedKeys = [];
|
|
61880
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
|
|
61881
|
+
modifiersType,
|
|
61882
|
+
8576 /* StringOrNumberLiteralOrUnique */,
|
|
61883
|
+
/*stringsOnly*/
|
|
61884
|
+
false,
|
|
61885
|
+
(t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
|
|
61886
|
+
);
|
|
61887
|
+
targetKeys = getUnionType([...mappedKeys, nameType]);
|
|
61888
61888
|
} else {
|
|
61889
61889
|
targetKeys = nameType || constraintType;
|
|
61890
61890
|
}
|
|
@@ -62055,18 +62055,9 @@ function createTypeChecker(host) {
|
|
|
62055
62055
|
}
|
|
62056
62056
|
}
|
|
62057
62057
|
} else if (sourceFlags & 4194304 /* Index */) {
|
|
62058
|
-
|
|
62059
|
-
if (result2 = isRelatedTo(keyofConstraintType, target2, 1 /* Source */, reportErrors2 && !isDeferredMappedIndex)) {
|
|
62058
|
+
if (result2 = isRelatedTo(keyofConstraintType, target2, 1 /* Source */, reportErrors2)) {
|
|
62060
62059
|
return result2;
|
|
62061
62060
|
}
|
|
62062
|
-
if (isDeferredMappedIndex) {
|
|
62063
|
-
const mappedType = source2.type;
|
|
62064
|
-
const nameType = getNameTypeFromMappedType(mappedType);
|
|
62065
|
-
const sourceMappedKeys = nameType && isMappedTypeWithKeyofConstraintDeclaration(mappedType) ? getApparentMappedTypeKeys(nameType, mappedType) : nameType || getConstraintTypeFromMappedType(mappedType);
|
|
62066
|
-
if (result2 = isRelatedTo(sourceMappedKeys, target2, 1 /* Source */, reportErrors2)) {
|
|
62067
|
-
return result2;
|
|
62068
|
-
}
|
|
62069
|
-
}
|
|
62070
62061
|
} else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
|
|
62071
62062
|
if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
|
|
62072
62063
|
const constraint = getBaseConstraintOfType(source2);
|
|
@@ -64642,7 +64633,10 @@ function createTypeChecker(host) {
|
|
|
64642
64633
|
}
|
|
64643
64634
|
}
|
|
64644
64635
|
function inferToMappedType(source, target, constraintType) {
|
|
64645
|
-
if (constraintType.flags &
|
|
64636
|
+
if (constraintType.flags & 4194304 /* Index */) {
|
|
64637
|
+
constraintType = getSimplifiedIndexType(constraintType);
|
|
64638
|
+
}
|
|
64639
|
+
if (constraintType.flags & 3145728 /* UnionOrIntersection */) {
|
|
64646
64640
|
let result = false;
|
|
64647
64641
|
for (const type of constraintType.types) {
|
|
64648
64642
|
result = inferToMappedType(source, target, type) || result;
|
|
@@ -67098,6 +67092,16 @@ function createTypeChecker(host) {
|
|
|
67098
67092
|
}
|
|
67099
67093
|
return symbol.isAssigned || false;
|
|
67100
67094
|
}
|
|
67095
|
+
function isSomeSymbolAssigned(rootDeclaration) {
|
|
67096
|
+
Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
|
|
67097
|
+
return isSomeSymbolAssignedWorker(rootDeclaration.name);
|
|
67098
|
+
}
|
|
67099
|
+
function isSomeSymbolAssignedWorker(node) {
|
|
67100
|
+
if (node.kind === 80 /* Identifier */) {
|
|
67101
|
+
return isSymbolAssigned(getSymbolOfDeclaration(node.parent));
|
|
67102
|
+
}
|
|
67103
|
+
return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
|
|
67104
|
+
}
|
|
67101
67105
|
function hasParentWithAssignmentsMarked(node) {
|
|
67102
67106
|
return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
67103
67107
|
}
|
|
@@ -67211,7 +67215,7 @@ function createTypeChecker(host) {
|
|
|
67211
67215
|
const parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
67212
67216
|
const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType);
|
|
67213
67217
|
links.flags &= ~4194304 /* InCheckIdentifier */;
|
|
67214
|
-
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(rootDeclaration.kind === 169 /* Parameter */ &&
|
|
67218
|
+
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(rootDeclaration.kind === 169 /* Parameter */ && isSomeSymbolAssigned(rootDeclaration))) {
|
|
67215
67219
|
const pattern = declaration.parent;
|
|
67216
67220
|
const narrowedType = getFlowTypeOfReference(
|
|
67217
67221
|
pattern,
|
|
@@ -67240,7 +67244,7 @@ function createTypeChecker(host) {
|
|
|
67240
67244
|
const contextualSignature = getContextualSignature(func);
|
|
67241
67245
|
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
67242
67246
|
const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a = getInferenceContext(func)) == null ? void 0 : _a.nonFixingMapper));
|
|
67243
|
-
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !
|
|
67247
|
+
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !some(func.parameters, isSomeSymbolAssigned)) {
|
|
67244
67248
|
const narrowedType = getFlowTypeOfReference(
|
|
67245
67249
|
func,
|
|
67246
67250
|
restType,
|
|
@@ -81745,9 +81749,12 @@ function createTypeChecker(host) {
|
|
|
81745
81749
|
case 1 /* ExportsProperty */:
|
|
81746
81750
|
case 3 /* PrototypeProperty */:
|
|
81747
81751
|
return getSymbolOfNode(entityName.parent);
|
|
81752
|
+
case 5 /* Property */:
|
|
81753
|
+
if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) {
|
|
81754
|
+
return void 0;
|
|
81755
|
+
}
|
|
81748
81756
|
case 4 /* ThisProperty */:
|
|
81749
81757
|
case 2 /* ModuleExports */:
|
|
81750
|
-
case 5 /* Property */:
|
|
81751
81758
|
return getSymbolOfDeclaration(entityName.parent.parent);
|
|
81752
81759
|
}
|
|
81753
81760
|
}
|
|
@@ -108289,6 +108296,9 @@ function transformDeclarations(context) {
|
|
|
108289
108296
|
}
|
|
108290
108297
|
function mapReferencesIntoArray(references2, outputFilePath2) {
|
|
108291
108298
|
return (file) => {
|
|
108299
|
+
if (exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.includes(file.symbol)) {
|
|
108300
|
+
return;
|
|
108301
|
+
}
|
|
108292
108302
|
let declFileName;
|
|
108293
108303
|
if (file.isDeclarationFile) {
|
|
108294
108304
|
declFileName = file.fileName;
|
package/lib/tsserver.js
CHANGED
|
@@ -2335,7 +2335,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2335
2335
|
|
|
2336
2336
|
// src/compiler/corePublic.ts
|
|
2337
2337
|
var versionMajorMinor = "5.4";
|
|
2338
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2338
|
+
var version = `${versionMajorMinor}.0-insiders.20231212`;
|
|
2339
2339
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2340
2340
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2341
2341
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6680,7 +6680,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6680
6680
|
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
|
|
6681
6681
|
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
|
|
6682
6682
|
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
|
|
6683
|
-
TypeFlags2[TypeFlags2["Simplifiable"] =
|
|
6683
|
+
TypeFlags2[TypeFlags2["Simplifiable"] = 29360128] = "Simplifiable";
|
|
6684
6684
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
6685
6685
|
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
|
|
6686
6686
|
TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask";
|
|
@@ -62530,7 +62530,7 @@ function createTypeChecker(host) {
|
|
|
62530
62530
|
);
|
|
62531
62531
|
}
|
|
62532
62532
|
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
62533
|
-
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 */)
|
|
62533
|
+
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 */));
|
|
62534
62534
|
}
|
|
62535
62535
|
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
62536
62536
|
type = getReducedType(type);
|
|
@@ -62969,10 +62969,10 @@ function createTypeChecker(host) {
|
|
|
62969
62969
|
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);
|
|
62970
62970
|
}
|
|
62971
62971
|
function getSimplifiedType(type, writing) {
|
|
62972
|
-
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
62972
|
+
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type.flags & 4194304 /* Index */ ? getSimplifiedIndexType(type) : type;
|
|
62973
62973
|
}
|
|
62974
62974
|
function distributeIndexOverObjectType(objectType, indexType, writing) {
|
|
62975
|
-
if (objectType.flags & 1048576 /* Union */ || objectType.flags & 2097152 /* Intersection */ && !
|
|
62975
|
+
if (objectType.flags & 1048576 /* Union */ || objectType.flags & 2097152 /* Intersection */ && !(maybeTypeOfKind(objectType, 465829888 /* Instantiable */) && some(objectType.types, isEmptyAnonymousObjectType))) {
|
|
62976
62976
|
const types = map(objectType.types, (t) => getSimplifiedType(getIndexedAccessType(t, indexType), writing));
|
|
62977
62977
|
return objectType.flags & 2097152 /* Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
|
|
62978
62978
|
}
|
|
@@ -63040,6 +63040,10 @@ function createTypeChecker(host) {
|
|
|
63040
63040
|
}
|
|
63041
63041
|
return type;
|
|
63042
63042
|
}
|
|
63043
|
+
function getSimplifiedIndexType(type) {
|
|
63044
|
+
const target = type.type;
|
|
63045
|
+
return target.flags & 2097152 /* Intersection */ && !some(target.types, isEmptyAnonymousObjectType) ? getUnionType(map(target.types, (t) => getIndexType(t, type.indexFlags))) : type;
|
|
63046
|
+
}
|
|
63043
63047
|
function isIntersectionEmpty(type1, type2) {
|
|
63044
63048
|
return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
|
|
63045
63049
|
}
|
|
@@ -65300,7 +65304,7 @@ function createTypeChecker(host) {
|
|
|
65300
65304
|
}
|
|
65301
65305
|
function getNormalizedType(type, writing) {
|
|
65302
65306
|
while (true) {
|
|
65303
|
-
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 &
|
|
65307
|
+
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 & 29360128 /* Simplifiable */ ? getSimplifiedType(type, writing) : type;
|
|
65304
65308
|
if (t === type)
|
|
65305
65309
|
return t;
|
|
65306
65310
|
type = t;
|
|
@@ -65321,7 +65325,7 @@ function createTypeChecker(host) {
|
|
|
65321
65325
|
}
|
|
65322
65326
|
function getNormalizedTupleType(type, writing) {
|
|
65323
65327
|
const elements = getElementTypes(type);
|
|
65324
|
-
const normalizedElements = sameMap(elements, (t) => t.flags &
|
|
65328
|
+
const normalizedElements = sameMap(elements, (t) => t.flags & 29360128 /* Simplifiable */ ? getSimplifiedType(t, writing) : t);
|
|
65325
65329
|
return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type;
|
|
65326
65330
|
}
|
|
65327
65331
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
@@ -66404,18 +66408,6 @@ function createTypeChecker(host) {
|
|
|
66404
66408
|
}
|
|
66405
66409
|
return result2;
|
|
66406
66410
|
}
|
|
66407
|
-
function getApparentMappedTypeKeys(nameType, targetType) {
|
|
66408
|
-
const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType));
|
|
66409
|
-
const mappedKeys = [];
|
|
66410
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
|
|
66411
|
-
modifiersType,
|
|
66412
|
-
8576 /* StringOrNumberLiteralOrUnique */,
|
|
66413
|
-
/*stringsOnly*/
|
|
66414
|
-
false,
|
|
66415
|
-
(t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
|
|
66416
|
-
);
|
|
66417
|
-
return getUnionType(mappedKeys);
|
|
66418
|
-
}
|
|
66419
66411
|
function structuredTypeRelatedToWorker(source2, target2, reportErrors2, intersectionState, saveErrorInfo) {
|
|
66420
66412
|
let result2;
|
|
66421
66413
|
let originalErrorInfo;
|
|
@@ -66598,8 +66590,16 @@ function createTypeChecker(host) {
|
|
|
66598
66590
|
const constraintType = getConstraintTypeFromMappedType(targetType);
|
|
66599
66591
|
let targetKeys;
|
|
66600
66592
|
if (nameType && isMappedTypeWithKeyofConstraintDeclaration(targetType)) {
|
|
66601
|
-
const
|
|
66602
|
-
|
|
66593
|
+
const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType));
|
|
66594
|
+
const mappedKeys = [];
|
|
66595
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
|
|
66596
|
+
modifiersType,
|
|
66597
|
+
8576 /* StringOrNumberLiteralOrUnique */,
|
|
66598
|
+
/*stringsOnly*/
|
|
66599
|
+
false,
|
|
66600
|
+
(t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
|
|
66601
|
+
);
|
|
66602
|
+
targetKeys = getUnionType([...mappedKeys, nameType]);
|
|
66603
66603
|
} else {
|
|
66604
66604
|
targetKeys = nameType || constraintType;
|
|
66605
66605
|
}
|
|
@@ -66770,18 +66770,9 @@ function createTypeChecker(host) {
|
|
|
66770
66770
|
}
|
|
66771
66771
|
}
|
|
66772
66772
|
} else if (sourceFlags & 4194304 /* Index */) {
|
|
66773
|
-
|
|
66774
|
-
if (result2 = isRelatedTo(keyofConstraintType, target2, 1 /* Source */, reportErrors2 && !isDeferredMappedIndex)) {
|
|
66773
|
+
if (result2 = isRelatedTo(keyofConstraintType, target2, 1 /* Source */, reportErrors2)) {
|
|
66775
66774
|
return result2;
|
|
66776
66775
|
}
|
|
66777
|
-
if (isDeferredMappedIndex) {
|
|
66778
|
-
const mappedType = source2.type;
|
|
66779
|
-
const nameType = getNameTypeFromMappedType(mappedType);
|
|
66780
|
-
const sourceMappedKeys = nameType && isMappedTypeWithKeyofConstraintDeclaration(mappedType) ? getApparentMappedTypeKeys(nameType, mappedType) : nameType || getConstraintTypeFromMappedType(mappedType);
|
|
66781
|
-
if (result2 = isRelatedTo(sourceMappedKeys, target2, 1 /* Source */, reportErrors2)) {
|
|
66782
|
-
return result2;
|
|
66783
|
-
}
|
|
66784
|
-
}
|
|
66785
66776
|
} else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
|
|
66786
66777
|
if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
|
|
66787
66778
|
const constraint = getBaseConstraintOfType(source2);
|
|
@@ -69357,7 +69348,10 @@ function createTypeChecker(host) {
|
|
|
69357
69348
|
}
|
|
69358
69349
|
}
|
|
69359
69350
|
function inferToMappedType(source, target, constraintType) {
|
|
69360
|
-
if (constraintType.flags &
|
|
69351
|
+
if (constraintType.flags & 4194304 /* Index */) {
|
|
69352
|
+
constraintType = getSimplifiedIndexType(constraintType);
|
|
69353
|
+
}
|
|
69354
|
+
if (constraintType.flags & 3145728 /* UnionOrIntersection */) {
|
|
69361
69355
|
let result = false;
|
|
69362
69356
|
for (const type of constraintType.types) {
|
|
69363
69357
|
result = inferToMappedType(source, target, type) || result;
|
|
@@ -71813,6 +71807,16 @@ function createTypeChecker(host) {
|
|
|
71813
71807
|
}
|
|
71814
71808
|
return symbol.isAssigned || false;
|
|
71815
71809
|
}
|
|
71810
|
+
function isSomeSymbolAssigned(rootDeclaration) {
|
|
71811
|
+
Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
|
|
71812
|
+
return isSomeSymbolAssignedWorker(rootDeclaration.name);
|
|
71813
|
+
}
|
|
71814
|
+
function isSomeSymbolAssignedWorker(node) {
|
|
71815
|
+
if (node.kind === 80 /* Identifier */) {
|
|
71816
|
+
return isSymbolAssigned(getSymbolOfDeclaration(node.parent));
|
|
71817
|
+
}
|
|
71818
|
+
return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
|
|
71819
|
+
}
|
|
71816
71820
|
function hasParentWithAssignmentsMarked(node) {
|
|
71817
71821
|
return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
71818
71822
|
}
|
|
@@ -71926,7 +71930,7 @@ function createTypeChecker(host) {
|
|
|
71926
71930
|
const parentType = getTypeForBindingElementParent(parent2, 0 /* Normal */);
|
|
71927
71931
|
const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType);
|
|
71928
71932
|
links.flags &= ~4194304 /* InCheckIdentifier */;
|
|
71929
|
-
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(rootDeclaration.kind === 169 /* Parameter */ &&
|
|
71933
|
+
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(rootDeclaration.kind === 169 /* Parameter */ && isSomeSymbolAssigned(rootDeclaration))) {
|
|
71930
71934
|
const pattern = declaration.parent;
|
|
71931
71935
|
const narrowedType = getFlowTypeOfReference(
|
|
71932
71936
|
pattern,
|
|
@@ -71955,7 +71959,7 @@ function createTypeChecker(host) {
|
|
|
71955
71959
|
const contextualSignature = getContextualSignature(func);
|
|
71956
71960
|
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
71957
71961
|
const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a = getInferenceContext(func)) == null ? void 0 : _a.nonFixingMapper));
|
|
71958
|
-
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !
|
|
71962
|
+
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !some(func.parameters, isSomeSymbolAssigned)) {
|
|
71959
71963
|
const narrowedType = getFlowTypeOfReference(
|
|
71960
71964
|
func,
|
|
71961
71965
|
restType,
|
|
@@ -86460,9 +86464,12 @@ function createTypeChecker(host) {
|
|
|
86460
86464
|
case 1 /* ExportsProperty */:
|
|
86461
86465
|
case 3 /* PrototypeProperty */:
|
|
86462
86466
|
return getSymbolOfNode(entityName.parent);
|
|
86467
|
+
case 5 /* Property */:
|
|
86468
|
+
if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) {
|
|
86469
|
+
return void 0;
|
|
86470
|
+
}
|
|
86463
86471
|
case 4 /* ThisProperty */:
|
|
86464
86472
|
case 2 /* ModuleExports */:
|
|
86465
|
-
case 5 /* Property */:
|
|
86466
86473
|
return getSymbolOfDeclaration(entityName.parent.parent);
|
|
86467
86474
|
}
|
|
86468
86475
|
}
|
|
@@ -113175,6 +113182,9 @@ function transformDeclarations(context) {
|
|
|
113175
113182
|
}
|
|
113176
113183
|
function mapReferencesIntoArray(references2, outputFilePath2) {
|
|
113177
113184
|
return (file) => {
|
|
113185
|
+
if (exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.includes(file.symbol)) {
|
|
113186
|
+
return;
|
|
113187
|
+
}
|
|
113178
113188
|
let declFileName;
|
|
113179
113189
|
if (file.isDeclarationFile) {
|
|
113180
113190
|
declFileName = file.fileName;
|
|
@@ -160307,7 +160317,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
160307
160317
|
case 59 /* ColonToken */:
|
|
160308
160318
|
return parentKind === 172 /* PropertyDeclaration */ || parentKind === 171 /* PropertySignature */ || parentKind === 169 /* Parameter */ || parentKind === 260 /* VariableDeclaration */ || isFunctionLikeKind(parentKind);
|
|
160309
160319
|
case 64 /* EqualsToken */:
|
|
160310
|
-
return parentKind === 265 /* TypeAliasDeclaration */;
|
|
160320
|
+
return parentKind === 265 /* TypeAliasDeclaration */ || parentKind === 168 /* TypeParameter */;
|
|
160311
160321
|
case 130 /* AsKeyword */:
|
|
160312
160322
|
return parentKind === 234 /* AsExpression */;
|
|
160313
160323
|
case 30 /* LessThanToken */:
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.4";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20231212`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4438,7 +4438,7 @@ ${lanes.join("\n")}
|
|
|
4438
4438
|
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
|
|
4439
4439
|
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
|
|
4440
4440
|
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
|
|
4441
|
-
TypeFlags2[TypeFlags2["Simplifiable"] =
|
|
4441
|
+
TypeFlags2[TypeFlags2["Simplifiable"] = 29360128] = "Simplifiable";
|
|
4442
4442
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
4443
4443
|
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
|
|
4444
4444
|
TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask";
|
|
@@ -60290,7 +60290,7 @@ ${lanes.join("\n")}
|
|
|
60290
60290
|
);
|
|
60291
60291
|
}
|
|
60292
60292
|
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
60293
|
-
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 */)
|
|
60293
|
+
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 */));
|
|
60294
60294
|
}
|
|
60295
60295
|
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
60296
60296
|
type = getReducedType(type);
|
|
@@ -60729,10 +60729,10 @@ ${lanes.join("\n")}
|
|
|
60729
60729
|
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);
|
|
60730
60730
|
}
|
|
60731
60731
|
function getSimplifiedType(type, writing) {
|
|
60732
|
-
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
60732
|
+
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type.flags & 4194304 /* Index */ ? getSimplifiedIndexType(type) : type;
|
|
60733
60733
|
}
|
|
60734
60734
|
function distributeIndexOverObjectType(objectType, indexType, writing) {
|
|
60735
|
-
if (objectType.flags & 1048576 /* Union */ || objectType.flags & 2097152 /* Intersection */ && !
|
|
60735
|
+
if (objectType.flags & 1048576 /* Union */ || objectType.flags & 2097152 /* Intersection */ && !(maybeTypeOfKind(objectType, 465829888 /* Instantiable */) && some(objectType.types, isEmptyAnonymousObjectType))) {
|
|
60736
60736
|
const types = map(objectType.types, (t) => getSimplifiedType(getIndexedAccessType(t, indexType), writing));
|
|
60737
60737
|
return objectType.flags & 2097152 /* Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
|
|
60738
60738
|
}
|
|
@@ -60800,6 +60800,10 @@ ${lanes.join("\n")}
|
|
|
60800
60800
|
}
|
|
60801
60801
|
return type;
|
|
60802
60802
|
}
|
|
60803
|
+
function getSimplifiedIndexType(type) {
|
|
60804
|
+
const target = type.type;
|
|
60805
|
+
return target.flags & 2097152 /* Intersection */ && !some(target.types, isEmptyAnonymousObjectType) ? getUnionType(map(target.types, (t) => getIndexType(t, type.indexFlags))) : type;
|
|
60806
|
+
}
|
|
60803
60807
|
function isIntersectionEmpty(type1, type2) {
|
|
60804
60808
|
return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
|
|
60805
60809
|
}
|
|
@@ -63060,7 +63064,7 @@ ${lanes.join("\n")}
|
|
|
63060
63064
|
}
|
|
63061
63065
|
function getNormalizedType(type, writing) {
|
|
63062
63066
|
while (true) {
|
|
63063
|
-
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 &
|
|
63067
|
+
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 & 29360128 /* Simplifiable */ ? getSimplifiedType(type, writing) : type;
|
|
63064
63068
|
if (t === type)
|
|
63065
63069
|
return t;
|
|
63066
63070
|
type = t;
|
|
@@ -63081,7 +63085,7 @@ ${lanes.join("\n")}
|
|
|
63081
63085
|
}
|
|
63082
63086
|
function getNormalizedTupleType(type, writing) {
|
|
63083
63087
|
const elements = getElementTypes(type);
|
|
63084
|
-
const normalizedElements = sameMap(elements, (t) => t.flags &
|
|
63088
|
+
const normalizedElements = sameMap(elements, (t) => t.flags & 29360128 /* Simplifiable */ ? getSimplifiedType(t, writing) : t);
|
|
63085
63089
|
return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type;
|
|
63086
63090
|
}
|
|
63087
63091
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
@@ -64164,18 +64168,6 @@ ${lanes.join("\n")}
|
|
|
64164
64168
|
}
|
|
64165
64169
|
return result2;
|
|
64166
64170
|
}
|
|
64167
|
-
function getApparentMappedTypeKeys(nameType, targetType) {
|
|
64168
|
-
const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType));
|
|
64169
|
-
const mappedKeys = [];
|
|
64170
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
|
|
64171
|
-
modifiersType,
|
|
64172
|
-
8576 /* StringOrNumberLiteralOrUnique */,
|
|
64173
|
-
/*stringsOnly*/
|
|
64174
|
-
false,
|
|
64175
|
-
(t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
|
|
64176
|
-
);
|
|
64177
|
-
return getUnionType(mappedKeys);
|
|
64178
|
-
}
|
|
64179
64171
|
function structuredTypeRelatedToWorker(source2, target2, reportErrors2, intersectionState, saveErrorInfo) {
|
|
64180
64172
|
let result2;
|
|
64181
64173
|
let originalErrorInfo;
|
|
@@ -64358,8 +64350,16 @@ ${lanes.join("\n")}
|
|
|
64358
64350
|
const constraintType = getConstraintTypeFromMappedType(targetType);
|
|
64359
64351
|
let targetKeys;
|
|
64360
64352
|
if (nameType && isMappedTypeWithKeyofConstraintDeclaration(targetType)) {
|
|
64361
|
-
const
|
|
64362
|
-
|
|
64353
|
+
const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType));
|
|
64354
|
+
const mappedKeys = [];
|
|
64355
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(
|
|
64356
|
+
modifiersType,
|
|
64357
|
+
8576 /* StringOrNumberLiteralOrUnique */,
|
|
64358
|
+
/*stringsOnly*/
|
|
64359
|
+
false,
|
|
64360
|
+
(t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))
|
|
64361
|
+
);
|
|
64362
|
+
targetKeys = getUnionType([...mappedKeys, nameType]);
|
|
64363
64363
|
} else {
|
|
64364
64364
|
targetKeys = nameType || constraintType;
|
|
64365
64365
|
}
|
|
@@ -64530,18 +64530,9 @@ ${lanes.join("\n")}
|
|
|
64530
64530
|
}
|
|
64531
64531
|
}
|
|
64532
64532
|
} else if (sourceFlags & 4194304 /* Index */) {
|
|
64533
|
-
|
|
64534
|
-
if (result2 = isRelatedTo(keyofConstraintType, target2, 1 /* Source */, reportErrors2 && !isDeferredMappedIndex)) {
|
|
64533
|
+
if (result2 = isRelatedTo(keyofConstraintType, target2, 1 /* Source */, reportErrors2)) {
|
|
64535
64534
|
return result2;
|
|
64536
64535
|
}
|
|
64537
|
-
if (isDeferredMappedIndex) {
|
|
64538
|
-
const mappedType = source2.type;
|
|
64539
|
-
const nameType = getNameTypeFromMappedType(mappedType);
|
|
64540
|
-
const sourceMappedKeys = nameType && isMappedTypeWithKeyofConstraintDeclaration(mappedType) ? getApparentMappedTypeKeys(nameType, mappedType) : nameType || getConstraintTypeFromMappedType(mappedType);
|
|
64541
|
-
if (result2 = isRelatedTo(sourceMappedKeys, target2, 1 /* Source */, reportErrors2)) {
|
|
64542
|
-
return result2;
|
|
64543
|
-
}
|
|
64544
|
-
}
|
|
64545
64536
|
} else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) {
|
|
64546
64537
|
if (!(targetFlags & 134217728 /* TemplateLiteral */)) {
|
|
64547
64538
|
const constraint = getBaseConstraintOfType(source2);
|
|
@@ -67117,7 +67108,10 @@ ${lanes.join("\n")}
|
|
|
67117
67108
|
}
|
|
67118
67109
|
}
|
|
67119
67110
|
function inferToMappedType(source, target, constraintType) {
|
|
67120
|
-
if (constraintType.flags &
|
|
67111
|
+
if (constraintType.flags & 4194304 /* Index */) {
|
|
67112
|
+
constraintType = getSimplifiedIndexType(constraintType);
|
|
67113
|
+
}
|
|
67114
|
+
if (constraintType.flags & 3145728 /* UnionOrIntersection */) {
|
|
67121
67115
|
let result = false;
|
|
67122
67116
|
for (const type of constraintType.types) {
|
|
67123
67117
|
result = inferToMappedType(source, target, type) || result;
|
|
@@ -69573,6 +69567,16 @@ ${lanes.join("\n")}
|
|
|
69573
69567
|
}
|
|
69574
69568
|
return symbol.isAssigned || false;
|
|
69575
69569
|
}
|
|
69570
|
+
function isSomeSymbolAssigned(rootDeclaration) {
|
|
69571
|
+
Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
|
|
69572
|
+
return isSomeSymbolAssignedWorker(rootDeclaration.name);
|
|
69573
|
+
}
|
|
69574
|
+
function isSomeSymbolAssignedWorker(node) {
|
|
69575
|
+
if (node.kind === 80 /* Identifier */) {
|
|
69576
|
+
return isSymbolAssigned(getSymbolOfDeclaration(node.parent));
|
|
69577
|
+
}
|
|
69578
|
+
return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
|
|
69579
|
+
}
|
|
69576
69580
|
function hasParentWithAssignmentsMarked(node) {
|
|
69577
69581
|
return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
69578
69582
|
}
|
|
@@ -69686,7 +69690,7 @@ ${lanes.join("\n")}
|
|
|
69686
69690
|
const parentType = getTypeForBindingElementParent(parent2, 0 /* Normal */);
|
|
69687
69691
|
const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType);
|
|
69688
69692
|
links.flags &= ~4194304 /* InCheckIdentifier */;
|
|
69689
|
-
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(rootDeclaration.kind === 169 /* Parameter */ &&
|
|
69693
|
+
if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(rootDeclaration.kind === 169 /* Parameter */ && isSomeSymbolAssigned(rootDeclaration))) {
|
|
69690
69694
|
const pattern = declaration.parent;
|
|
69691
69695
|
const narrowedType = getFlowTypeOfReference(
|
|
69692
69696
|
pattern,
|
|
@@ -69715,7 +69719,7 @@ ${lanes.join("\n")}
|
|
|
69715
69719
|
const contextualSignature = getContextualSignature(func);
|
|
69716
69720
|
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
69717
69721
|
const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a = getInferenceContext(func)) == null ? void 0 : _a.nonFixingMapper));
|
|
69718
|
-
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !
|
|
69722
|
+
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !some(func.parameters, isSomeSymbolAssigned)) {
|
|
69719
69723
|
const narrowedType = getFlowTypeOfReference(
|
|
69720
69724
|
func,
|
|
69721
69725
|
restType,
|
|
@@ -84220,9 +84224,12 @@ ${lanes.join("\n")}
|
|
|
84220
84224
|
case 1 /* ExportsProperty */:
|
|
84221
84225
|
case 3 /* PrototypeProperty */:
|
|
84222
84226
|
return getSymbolOfNode(entityName.parent);
|
|
84227
|
+
case 5 /* Property */:
|
|
84228
|
+
if (isPropertyAccessExpression(entityName.parent) && getLeftmostAccessExpression(entityName.parent) === entityName) {
|
|
84229
|
+
return void 0;
|
|
84230
|
+
}
|
|
84223
84231
|
case 4 /* ThisProperty */:
|
|
84224
84232
|
case 2 /* ModuleExports */:
|
|
84225
|
-
case 5 /* Property */:
|
|
84226
84233
|
return getSymbolOfDeclaration(entityName.parent.parent);
|
|
84227
84234
|
}
|
|
84228
84235
|
}
|
|
@@ -111244,6 +111251,9 @@ ${lanes.join("\n")}
|
|
|
111244
111251
|
}
|
|
111245
111252
|
function mapReferencesIntoArray(references2, outputFilePath2) {
|
|
111246
111253
|
return (file) => {
|
|
111254
|
+
if (exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.includes(file.symbol)) {
|
|
111255
|
+
return;
|
|
111256
|
+
}
|
|
111247
111257
|
let declFileName;
|
|
111248
111258
|
if (file.isDeclarationFile) {
|
|
111249
111259
|
declFileName = file.fileName;
|
|
@@ -159516,7 +159526,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159516
159526
|
case 59 /* ColonToken */:
|
|
159517
159527
|
return parentKind === 172 /* PropertyDeclaration */ || parentKind === 171 /* PropertySignature */ || parentKind === 169 /* Parameter */ || parentKind === 260 /* VariableDeclaration */ || isFunctionLikeKind(parentKind);
|
|
159518
159528
|
case 64 /* EqualsToken */:
|
|
159519
|
-
return parentKind === 265 /* TypeAliasDeclaration */;
|
|
159529
|
+
return parentKind === 265 /* TypeAliasDeclaration */ || parentKind === 168 /* TypeParameter */;
|
|
159520
159530
|
case 130 /* AsKeyword */:
|
|
159521
159531
|
return parentKind === 234 /* AsExpression */;
|
|
159522
159532
|
case 30 /* LessThanToken */:
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.4";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20231212`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -3096,7 +3096,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3096
3096
|
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
|
|
3097
3097
|
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
|
|
3098
3098
|
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
|
|
3099
|
-
TypeFlags2[TypeFlags2["Simplifiable"] =
|
|
3099
|
+
TypeFlags2[TypeFlags2["Simplifiable"] = 29360128] = "Simplifiable";
|
|
3100
3100
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
3101
3101
|
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
|
|
3102
3102
|
TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask";
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-pr-
|
|
5
|
+
"version": "5.4.0-pr-56652-11",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"node": "20.1.0",
|
|
115
115
|
"npm": "8.19.4"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "7a3beaa6e739ed337d66db66784a79f776193654"
|
|
118
118
|
}
|