typescript 5.4.0-dev.20231129 → 5.4.0-dev.20231201
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.es2018.intl.d.ts +4 -3
- package/lib/lib.es2020.intl.d.ts +36 -16
- package/lib/lib.es2020.string.d.ts +15 -1
- package/lib/lib.es2021.intl.d.ts +2 -2
- package/lib/lib.es2022.intl.d.ts +2 -2
- package/lib/lib.es5.d.ts +15 -6
- package/lib/lib.esnext.d.ts +1 -0
- package/lib/lib.esnext.promise.d.ts +35 -0
- package/lib/tsc.js +185 -55
- package/lib/tsserver.js +197 -56
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +197 -56
- package/lib/typingsInstaller.js +4 -2
- package/package.json +2 -2
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-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20231201`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4447,6 +4447,7 @@ ${lanes.join("\n")}
|
|
|
4447
4447
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
4448
4448
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
4449
4449
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
4450
|
+
TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 268435456 /* StringMapping */] = "IncludesConstrainedTypeVariable";
|
|
4450
4451
|
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
4451
4452
|
return TypeFlags2;
|
|
4452
4453
|
})(TypeFlags || {});
|
|
@@ -4493,6 +4494,7 @@ ${lanes.join("\n")}
|
|
|
4493
4494
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
|
|
4494
4495
|
ObjectFlags3[ObjectFlags3["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
|
|
4495
4496
|
ObjectFlags3[ObjectFlags3["IsNeverIntersection"] = 33554432] = "IsNeverIntersection";
|
|
4497
|
+
ObjectFlags3[ObjectFlags3["IsConstrainedTypeVariable"] = 67108864] = "IsConstrainedTypeVariable";
|
|
4496
4498
|
return ObjectFlags3;
|
|
4497
4499
|
})(ObjectFlags || {});
|
|
4498
4500
|
VarianceFlags = /* @__PURE__ */ ((VarianceFlags2) => {
|
|
@@ -37814,7 +37816,7 @@ ${lanes.join("\n")}
|
|
|
37814
37816
|
["esnext.disposable", "lib.esnext.disposable.d.ts"],
|
|
37815
37817
|
["esnext.bigint", "lib.es2020.bigint.d.ts"],
|
|
37816
37818
|
["esnext.string", "lib.es2022.string.d.ts"],
|
|
37817
|
-
["esnext.promise", "lib.
|
|
37819
|
+
["esnext.promise", "lib.esnext.promise.d.ts"],
|
|
37818
37820
|
["esnext.weakref", "lib.es2021.weakref.d.ts"],
|
|
37819
37821
|
["esnext.decorators", "lib.esnext.decorators.d.ts"],
|
|
37820
37822
|
["decorators", "lib.decorators.d.ts"],
|
|
@@ -44310,7 +44312,7 @@ ${lanes.join("\n")}
|
|
|
44310
44312
|
}
|
|
44311
44313
|
function bindSpecialPropertyAssignment(node) {
|
|
44312
44314
|
var _a;
|
|
44313
|
-
const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression,
|
|
44315
|
+
const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer) || lookupSymbolForPropertyAccess(node.left.expression, container);
|
|
44314
44316
|
if (!isInJSFile(node) && !isFunctionSymbol(parentSymbol)) {
|
|
44315
44317
|
return;
|
|
44316
44318
|
}
|
|
@@ -44408,7 +44410,7 @@ ${lanes.join("\n")}
|
|
|
44408
44410
|
return isBinaryExpression(propertyAccess.parent) ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 312 /* SourceFile */ : propertyAccess.parent.parent.kind === 312 /* SourceFile */;
|
|
44409
44411
|
}
|
|
44410
44412
|
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) {
|
|
44411
|
-
let namespaceSymbol = lookupSymbolForPropertyAccess(name,
|
|
44413
|
+
let namespaceSymbol = lookupSymbolForPropertyAccess(name, blockScopeContainer) || lookupSymbolForPropertyAccess(name, container);
|
|
44412
44414
|
const isToplevel = isTopLevelNamespaceAssignment(propertyAccess);
|
|
44413
44415
|
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty, containerIsClass);
|
|
44414
44416
|
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
|
|
@@ -49464,6 +49466,10 @@ ${lanes.join("\n")}
|
|
|
49464
49466
|
function getParentOfSymbol(symbol) {
|
|
49465
49467
|
return getMergedSymbol(symbol.parent && getLateBoundSymbol(symbol.parent));
|
|
49466
49468
|
}
|
|
49469
|
+
function getFunctionExpressionParentSymbolOrSymbol(symbol) {
|
|
49470
|
+
var _a, _b;
|
|
49471
|
+
return ((_a = symbol.valueDeclaration) == null ? void 0 : _a.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */ ? getSymbolOfNode(symbol.valueDeclaration.parent) || symbol : symbol;
|
|
49472
|
+
}
|
|
49467
49473
|
function getAlternativeContainingModules(symbol, enclosingDeclaration) {
|
|
49468
49474
|
const containingFile = getSourceFileOfNode(enclosingDeclaration);
|
|
49469
49475
|
const id = getNodeId(containingFile);
|
|
@@ -54687,11 +54693,14 @@ ${lanes.join("\n")}
|
|
|
54687
54693
|
}
|
|
54688
54694
|
}
|
|
54689
54695
|
if ((_a = symbol.parent) == null ? void 0 : _a.valueDeclaration) {
|
|
54690
|
-
const
|
|
54691
|
-
if (
|
|
54692
|
-
const
|
|
54693
|
-
if (
|
|
54694
|
-
|
|
54696
|
+
const possiblyAnnotatedSymbol = getFunctionExpressionParentSymbolOrSymbol(symbol.parent);
|
|
54697
|
+
if (possiblyAnnotatedSymbol.valueDeclaration) {
|
|
54698
|
+
const typeNode2 = getEffectiveTypeAnnotationNode(possiblyAnnotatedSymbol.valueDeclaration);
|
|
54699
|
+
if (typeNode2) {
|
|
54700
|
+
const annotationSymbol = getPropertyOfType(getTypeFromTypeNode(typeNode2), symbol.escapedName);
|
|
54701
|
+
if (annotationSymbol) {
|
|
54702
|
+
return getNonMissingTypeOfSymbol(annotationSymbol);
|
|
54703
|
+
}
|
|
54695
54704
|
}
|
|
54696
54705
|
}
|
|
54697
54706
|
}
|
|
@@ -55991,7 +56000,6 @@ ${lanes.join("\n")}
|
|
|
55991
56000
|
return links.resolvedSymbol;
|
|
55992
56001
|
}
|
|
55993
56002
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
55994
|
-
var _a, _b, _c;
|
|
55995
56003
|
const links = getSymbolLinks(symbol);
|
|
55996
56004
|
if (!links[resolutionKind]) {
|
|
55997
56005
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -56010,7 +56018,7 @@ ${lanes.join("\n")}
|
|
|
56010
56018
|
}
|
|
56011
56019
|
}
|
|
56012
56020
|
}
|
|
56013
|
-
const assignments = (
|
|
56021
|
+
const assignments = getFunctionExpressionParentSymbolOrSymbol(symbol).assignmentDeclarationMembers;
|
|
56014
56022
|
if (assignments) {
|
|
56015
56023
|
const decls = arrayFrom(assignments.values());
|
|
56016
56024
|
for (const member of decls) {
|
|
@@ -56307,6 +56315,15 @@ ${lanes.join("\n")}
|
|
|
56307
56315
|
let result;
|
|
56308
56316
|
for (let i = 0; i < signatureLists.length; i++) {
|
|
56309
56317
|
const match = i === listIndex ? signature : findMatchingSignature(
|
|
56318
|
+
signatureLists[i],
|
|
56319
|
+
signature,
|
|
56320
|
+
/*partialMatch*/
|
|
56321
|
+
false,
|
|
56322
|
+
/*ignoreThisTypes*/
|
|
56323
|
+
false,
|
|
56324
|
+
/*ignoreReturnTypes*/
|
|
56325
|
+
true
|
|
56326
|
+
) || findMatchingSignature(
|
|
56310
56327
|
signatureLists[i],
|
|
56311
56328
|
signature,
|
|
56312
56329
|
/*partialMatch*/
|
|
@@ -56680,6 +56697,18 @@ ${lanes.join("\n")}
|
|
|
56680
56697
|
function replaceIndexedAccess(instantiable, type, replacement) {
|
|
56681
56698
|
return instantiateType(instantiable, createTypeMapper([type.indexType, type.objectType], [getNumberLiteralType(0), createTupleType([replacement])]));
|
|
56682
56699
|
}
|
|
56700
|
+
function getLimitedConstraint(type) {
|
|
56701
|
+
const constraint = getConstraintTypeFromMappedType(type.mappedType);
|
|
56702
|
+
if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) {
|
|
56703
|
+
return;
|
|
56704
|
+
}
|
|
56705
|
+
const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint;
|
|
56706
|
+
if (!origin || !(origin.flags & 2097152 /* Intersection */)) {
|
|
56707
|
+
return;
|
|
56708
|
+
}
|
|
56709
|
+
const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType));
|
|
56710
|
+
return limitedConstraint !== neverType ? limitedConstraint : void 0;
|
|
56711
|
+
}
|
|
56683
56712
|
function resolveReverseMappedTypeMembers(type) {
|
|
56684
56713
|
const indexInfo = getIndexInfoOfType(type.source, stringType);
|
|
56685
56714
|
const modifiers = getMappedTypeModifiers(type.mappedType);
|
|
@@ -56687,7 +56716,14 @@ ${lanes.join("\n")}
|
|
|
56687
56716
|
const optionalMask = modifiers & 4 /* IncludeOptional */ ? 0 : 16777216 /* Optional */;
|
|
56688
56717
|
const indexInfos = indexInfo ? [createIndexInfo(stringType, inferReverseMappedType(indexInfo.type, type.mappedType, type.constraintType), readonlyMask && indexInfo.isReadonly)] : emptyArray;
|
|
56689
56718
|
const members = createSymbolTable();
|
|
56719
|
+
const limitedConstraint = getLimitedConstraint(type);
|
|
56690
56720
|
for (const prop of getPropertiesOfType(type.source)) {
|
|
56721
|
+
if (limitedConstraint) {
|
|
56722
|
+
const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */);
|
|
56723
|
+
if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) {
|
|
56724
|
+
continue;
|
|
56725
|
+
}
|
|
56726
|
+
}
|
|
56691
56727
|
const checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
|
|
56692
56728
|
const inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
|
|
56693
56729
|
inferredProp.declarations = prop.declarations;
|
|
@@ -56768,7 +56804,7 @@ ${lanes.join("\n")}
|
|
|
56768
56804
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
56769
56805
|
const mappedType = type.target || type;
|
|
56770
56806
|
const nameType = getNameTypeFromMappedType(mappedType);
|
|
56771
|
-
const shouldLinkPropDeclarations =
|
|
56807
|
+
const shouldLinkPropDeclarations = getMappedTypeNameTypeKind(mappedType) !== 2 /* Remapping */;
|
|
56772
56808
|
const templateType = getTemplateTypeFromMappedType(mappedType);
|
|
56773
56809
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
56774
56810
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
@@ -56910,9 +56946,12 @@ ${lanes.join("\n")}
|
|
|
56910
56946
|
}
|
|
56911
56947
|
return false;
|
|
56912
56948
|
}
|
|
56913
|
-
function
|
|
56949
|
+
function getMappedTypeNameTypeKind(type) {
|
|
56914
56950
|
const nameType = getNameTypeFromMappedType(type);
|
|
56915
|
-
|
|
56951
|
+
if (!nameType) {
|
|
56952
|
+
return 0 /* None */;
|
|
56953
|
+
}
|
|
56954
|
+
return isTypeAssignableTo(nameType, getTypeParameterFromMappedType(type)) ? 1 /* Filtering */ : 2 /* Remapping */;
|
|
56916
56955
|
}
|
|
56917
56956
|
function resolveStructuredTypeMembers(type) {
|
|
56918
56957
|
if (!type.members) {
|
|
@@ -56961,7 +57000,12 @@ ${lanes.join("\n")}
|
|
|
56961
57000
|
for (const current of type.types) {
|
|
56962
57001
|
for (const prop of getPropertiesOfType(current)) {
|
|
56963
57002
|
if (!members.has(prop.escapedName)) {
|
|
56964
|
-
const combinedProp = getPropertyOfUnionOrIntersectionType(
|
|
57003
|
+
const combinedProp = getPropertyOfUnionOrIntersectionType(
|
|
57004
|
+
type,
|
|
57005
|
+
prop.escapedName,
|
|
57006
|
+
/*skipObjectFunctionPropertyAugment*/
|
|
57007
|
+
!!(type.flags & 2097152 /* Intersection */)
|
|
57008
|
+
);
|
|
56965
57009
|
if (combinedProp) {
|
|
56966
57010
|
members.set(prop.escapedName, combinedProp);
|
|
56967
57011
|
}
|
|
@@ -57451,13 +57495,17 @@ ${lanes.join("\n")}
|
|
|
57451
57495
|
return result;
|
|
57452
57496
|
}
|
|
57453
57497
|
function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) {
|
|
57454
|
-
var _a, _b;
|
|
57498
|
+
var _a, _b, _c;
|
|
57455
57499
|
let property = ((_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a.get(name)) || !skipObjectFunctionPropertyAugment ? (_b = type.propertyCache) == null ? void 0 : _b.get(name) : void 0;
|
|
57456
57500
|
if (!property) {
|
|
57457
57501
|
property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment);
|
|
57458
57502
|
if (property) {
|
|
57459
57503
|
const properties = skipObjectFunctionPropertyAugment ? type.propertyCacheWithoutObjectFunctionPropertyAugment || (type.propertyCacheWithoutObjectFunctionPropertyAugment = createSymbolTable()) : type.propertyCache || (type.propertyCache = createSymbolTable());
|
|
57460
57504
|
properties.set(name, property);
|
|
57505
|
+
if (skipObjectFunctionPropertyAugment && !((_c = type.propertyCache) == null ? void 0 : _c.get(name))) {
|
|
57506
|
+
const properties2 = type.propertyCache || (type.propertyCache = createSymbolTable());
|
|
57507
|
+
properties2.set(name, property);
|
|
57508
|
+
}
|
|
57461
57509
|
}
|
|
57462
57510
|
}
|
|
57463
57511
|
return property;
|
|
@@ -57567,7 +57615,22 @@ ${lanes.join("\n")}
|
|
|
57567
57615
|
}
|
|
57568
57616
|
return getPropertyOfObjectType(globalObjectType, name);
|
|
57569
57617
|
}
|
|
57570
|
-
if (type.flags &
|
|
57618
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
57619
|
+
const prop = getPropertyOfUnionOrIntersectionType(
|
|
57620
|
+
type,
|
|
57621
|
+
name,
|
|
57622
|
+
/*skipObjectFunctionPropertyAugment*/
|
|
57623
|
+
true
|
|
57624
|
+
);
|
|
57625
|
+
if (prop) {
|
|
57626
|
+
return prop;
|
|
57627
|
+
}
|
|
57628
|
+
if (!skipObjectFunctionPropertyAugment) {
|
|
57629
|
+
return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment);
|
|
57630
|
+
}
|
|
57631
|
+
return void 0;
|
|
57632
|
+
}
|
|
57633
|
+
if (type.flags & 1048576 /* Union */) {
|
|
57571
57634
|
return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment);
|
|
57572
57635
|
}
|
|
57573
57636
|
return void 0;
|
|
@@ -59424,6 +59487,8 @@ ${lanes.join("\n")}
|
|
|
59424
59487
|
includes |= flags & 473694207 /* IncludesMask */;
|
|
59425
59488
|
if (flags & 465829888 /* Instantiable */)
|
|
59426
59489
|
includes |= 33554432 /* IncludesInstantiable */;
|
|
59490
|
+
if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */)
|
|
59491
|
+
includes |= 268435456 /* IncludesConstrainedTypeVariable */;
|
|
59427
59492
|
if (type === wildcardType)
|
|
59428
59493
|
includes |= 8388608 /* IncludesWildcard */;
|
|
59429
59494
|
if (!strictNullChecks && flags & 98304 /* Nullable */) {
|
|
@@ -59528,6 +59593,41 @@ ${lanes.join("\n")}
|
|
|
59528
59593
|
}
|
|
59529
59594
|
}
|
|
59530
59595
|
}
|
|
59596
|
+
function removeConstrainedTypeVariables(types) {
|
|
59597
|
+
const typeVariables = [];
|
|
59598
|
+
for (const type of types) {
|
|
59599
|
+
if (getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) {
|
|
59600
|
+
const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
59601
|
+
pushIfUnique(typeVariables, type.types[index]);
|
|
59602
|
+
}
|
|
59603
|
+
}
|
|
59604
|
+
for (const typeVariable of typeVariables) {
|
|
59605
|
+
const primitives = [];
|
|
59606
|
+
for (const type of types) {
|
|
59607
|
+
if (getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) {
|
|
59608
|
+
const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
59609
|
+
if (type.types[index] === typeVariable) {
|
|
59610
|
+
insertType(primitives, type.types[1 - index]);
|
|
59611
|
+
}
|
|
59612
|
+
}
|
|
59613
|
+
}
|
|
59614
|
+
const constraint = getBaseConstraintOfType(typeVariable);
|
|
59615
|
+
if (everyType(constraint, (t) => containsType(primitives, t))) {
|
|
59616
|
+
let i = types.length;
|
|
59617
|
+
while (i > 0) {
|
|
59618
|
+
i--;
|
|
59619
|
+
const type = types[i];
|
|
59620
|
+
if (getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) {
|
|
59621
|
+
const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
59622
|
+
if (type.types[index] === typeVariable && containsType(primitives, type.types[1 - index])) {
|
|
59623
|
+
orderedRemoveItemAt(types, i);
|
|
59624
|
+
}
|
|
59625
|
+
}
|
|
59626
|
+
}
|
|
59627
|
+
insertType(types, typeVariable);
|
|
59628
|
+
}
|
|
59629
|
+
}
|
|
59630
|
+
}
|
|
59531
59631
|
function isNamedUnionType(type) {
|
|
59532
59632
|
return !!(type.flags & 1048576 /* Union */ && (type.aliasSymbol || type.origin));
|
|
59533
59633
|
}
|
|
@@ -59593,6 +59693,9 @@ ${lanes.join("\n")}
|
|
|
59593
59693
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
59594
59694
|
removeStringLiteralsMatchedByTemplateLiterals(typeSet);
|
|
59595
59695
|
}
|
|
59696
|
+
if (includes & 268435456 /* IncludesConstrainedTypeVariable */) {
|
|
59697
|
+
removeConstrainedTypeVariables(typeSet);
|
|
59698
|
+
}
|
|
59596
59699
|
if (unionReduction === 2 /* Subtype */) {
|
|
59597
59700
|
typeSet = removeSubtypes(typeSet, !!(includes & 524288 /* Object */));
|
|
59598
59701
|
if (!typeSet) {
|
|
@@ -59805,9 +59908,9 @@ ${lanes.join("\n")}
|
|
|
59805
59908
|
types[index] = getUnionTypeFromSortedList(result, 32768 /* PrimitiveUnion */);
|
|
59806
59909
|
return true;
|
|
59807
59910
|
}
|
|
59808
|
-
function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
59911
|
+
function createIntersectionType(types, objectFlags, aliasSymbol, aliasTypeArguments) {
|
|
59809
59912
|
const result = createType(2097152 /* Intersection */);
|
|
59810
|
-
result.objectFlags = getPropagatingFlagsOfTypes(
|
|
59913
|
+
result.objectFlags = objectFlags | getPropagatingFlagsOfTypes(
|
|
59811
59914
|
types,
|
|
59812
59915
|
/*excludeKinds*/
|
|
59813
59916
|
98304 /* Nullable */
|
|
@@ -59821,6 +59924,7 @@ ${lanes.join("\n")}
|
|
|
59821
59924
|
const typeMembershipMap = /* @__PURE__ */ new Map();
|
|
59822
59925
|
const includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
59823
59926
|
const typeSet = arrayFrom(typeMembershipMap.values());
|
|
59927
|
+
let objectFlags = 0 /* None */;
|
|
59824
59928
|
if (includes & 131072 /* Never */) {
|
|
59825
59929
|
return contains(typeSet, silentNeverType) ? silentNeverType : neverType;
|
|
59826
59930
|
}
|
|
@@ -59849,6 +59953,25 @@ ${lanes.join("\n")}
|
|
|
59849
59953
|
if (typeSet.length === 1) {
|
|
59850
59954
|
return typeSet[0];
|
|
59851
59955
|
}
|
|
59956
|
+
if (typeSet.length === 2) {
|
|
59957
|
+
const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
|
|
59958
|
+
const typeVariable = typeSet[typeVarIndex];
|
|
59959
|
+
const primitiveType = typeSet[1 - typeVarIndex];
|
|
59960
|
+
if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || includes & 16777216 /* IncludesEmptyObject */)) {
|
|
59961
|
+
const constraint = getBaseConstraintOfType(typeVariable);
|
|
59962
|
+
if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) {
|
|
59963
|
+
if (isTypeStrictSubtypeOf(constraint, primitiveType)) {
|
|
59964
|
+
return typeVariable;
|
|
59965
|
+
}
|
|
59966
|
+
if (!(constraint.flags & 1048576 /* Union */ && someType(constraint, (c) => isTypeStrictSubtypeOf(c, primitiveType)))) {
|
|
59967
|
+
if (!isTypeStrictSubtypeOf(primitiveType, constraint)) {
|
|
59968
|
+
return neverType;
|
|
59969
|
+
}
|
|
59970
|
+
}
|
|
59971
|
+
objectFlags = 67108864 /* IsConstrainedTypeVariable */;
|
|
59972
|
+
}
|
|
59973
|
+
}
|
|
59974
|
+
}
|
|
59852
59975
|
const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
59853
59976
|
let result = intersectionTypes.get(id);
|
|
59854
59977
|
if (!result) {
|
|
@@ -59871,7 +59994,7 @@ ${lanes.join("\n")}
|
|
|
59871
59994
|
result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
|
|
59872
59995
|
}
|
|
59873
59996
|
} else {
|
|
59874
|
-
result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
|
59997
|
+
result = createIntersectionType(typeSet, objectFlags, aliasSymbol, aliasTypeArguments);
|
|
59875
59998
|
}
|
|
59876
59999
|
intersectionTypes.set(id, result);
|
|
59877
60000
|
}
|
|
@@ -60028,7 +60151,7 @@ ${lanes.join("\n")}
|
|
|
60028
60151
|
);
|
|
60029
60152
|
}
|
|
60030
60153
|
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
60031
|
-
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));
|
|
60154
|
+
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && (!hasDistributiveNameType(type) || getMappedTypeNameTypeKind(type) === 2 /* Remapping */) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
60032
60155
|
}
|
|
60033
60156
|
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
60034
60157
|
type = getReducedType(type);
|
|
@@ -60512,7 +60635,7 @@ ${lanes.join("\n")}
|
|
|
60512
60635
|
}
|
|
60513
60636
|
}
|
|
60514
60637
|
if (isGenericMappedType(objectType)) {
|
|
60515
|
-
if (
|
|
60638
|
+
if (getMappedTypeNameTypeKind(objectType) !== 2 /* Remapping */) {
|
|
60516
60639
|
return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), (t) => getSimplifiedType(t, writing));
|
|
60517
60640
|
}
|
|
60518
60641
|
}
|
|
@@ -66420,12 +66543,12 @@ ${lanes.join("\n")}
|
|
|
66420
66543
|
return false;
|
|
66421
66544
|
}
|
|
66422
66545
|
function isValidTypeForTemplateLiteralPlaceholder(source, target) {
|
|
66423
|
-
if (source === target || target.flags & (1 /* Any */ | 4 /* String */)) {
|
|
66424
|
-
return true;
|
|
66425
|
-
}
|
|
66426
66546
|
if (target.flags & 2097152 /* Intersection */) {
|
|
66427
66547
|
return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t));
|
|
66428
66548
|
}
|
|
66549
|
+
if (target.flags & 4 /* String */ || isTypeAssignableTo(source, target)) {
|
|
66550
|
+
return true;
|
|
66551
|
+
}
|
|
66429
66552
|
if (source.flags & 128 /* StringLiteral */) {
|
|
66430
66553
|
const value = source.value;
|
|
66431
66554
|
return !!(target.flags & 8 /* Number */ && isValidNumberString(
|
|
@@ -66442,7 +66565,7 @@ ${lanes.join("\n")}
|
|
|
66442
66565
|
const texts = source.texts;
|
|
66443
66566
|
return texts.length === 2 && texts[0] === "" && texts[1] === "" && isTypeAssignableTo(source.types[0], target);
|
|
66444
66567
|
}
|
|
66445
|
-
return
|
|
66568
|
+
return false;
|
|
66446
66569
|
}
|
|
66447
66570
|
function inferTypesFromTemplateLiteralType(source, target) {
|
|
66448
66571
|
return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arraysEqual(source.texts, target.texts) ? map(source.types, getStringLikeTypeForType) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : void 0;
|
|
@@ -66564,7 +66687,8 @@ ${lanes.join("\n")}
|
|
|
66564
66687
|
source = getIntersectionType(sources);
|
|
66565
66688
|
target = getIntersectionType(targets);
|
|
66566
66689
|
}
|
|
66567
|
-
}
|
|
66690
|
+
}
|
|
66691
|
+
if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
|
|
66568
66692
|
target = getActualTypeVariable(target);
|
|
66569
66693
|
}
|
|
66570
66694
|
if (target.flags & 8650752 /* TypeVariable */) {
|
|
@@ -66839,7 +66963,7 @@ ${lanes.join("\n")}
|
|
|
66839
66963
|
}
|
|
66840
66964
|
}
|
|
66841
66965
|
function inferToMappedType(source, target, constraintType) {
|
|
66842
|
-
if (constraintType.flags & 1048576 /* Union */) {
|
|
66966
|
+
if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) {
|
|
66843
66967
|
let result = false;
|
|
66844
66968
|
for (const type of constraintType.types) {
|
|
66845
66969
|
result = inferToMappedType(source, target, type) || result;
|
|
@@ -73581,19 +73705,9 @@ ${lanes.join("\n")}
|
|
|
73581
73705
|
return Debug.fail();
|
|
73582
73706
|
}
|
|
73583
73707
|
}
|
|
73584
|
-
function getDiagnosticSpanForCallNode(node
|
|
73585
|
-
let start;
|
|
73586
|
-
let length2;
|
|
73708
|
+
function getDiagnosticSpanForCallNode(node) {
|
|
73587
73709
|
const sourceFile = getSourceFileOfNode(node);
|
|
73588
|
-
|
|
73589
|
-
const nameSpan = getErrorSpanForNode(sourceFile, node.expression.name);
|
|
73590
|
-
start = nameSpan.start;
|
|
73591
|
-
length2 = doNotIncludeArguments ? nameSpan.length : node.end - start;
|
|
73592
|
-
} else {
|
|
73593
|
-
const expressionSpan = getErrorSpanForNode(sourceFile, node.expression);
|
|
73594
|
-
start = expressionSpan.start;
|
|
73595
|
-
length2 = doNotIncludeArguments ? expressionSpan.length : node.end - start;
|
|
73596
|
-
}
|
|
73710
|
+
const { start, length: length2 } = getErrorSpanForNode(sourceFile, isPropertyAccessExpression(node.expression) ? node.expression.name : node.expression);
|
|
73597
73711
|
return { start, length: length2, sourceFile };
|
|
73598
73712
|
}
|
|
73599
73713
|
function getDiagnosticForCallNode(node, message, ...args) {
|
|
@@ -73610,6 +73724,18 @@ ${lanes.join("\n")}
|
|
|
73610
73724
|
return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message);
|
|
73611
73725
|
}
|
|
73612
73726
|
}
|
|
73727
|
+
function getErrorNodeForCallNode(callLike) {
|
|
73728
|
+
if (isCallOrNewExpression(callLike)) {
|
|
73729
|
+
return isPropertyAccessExpression(callLike.expression) ? callLike.expression.name : callLike.expression;
|
|
73730
|
+
}
|
|
73731
|
+
if (isTaggedTemplateExpression(callLike)) {
|
|
73732
|
+
return isPropertyAccessExpression(callLike.tag) ? callLike.tag.name : callLike.tag;
|
|
73733
|
+
}
|
|
73734
|
+
if (isJsxOpeningLikeElement(callLike)) {
|
|
73735
|
+
return callLike.tagName;
|
|
73736
|
+
}
|
|
73737
|
+
return callLike;
|
|
73738
|
+
}
|
|
73613
73739
|
function isPromiseResolveArityError(node) {
|
|
73614
73740
|
if (!isCallExpression(node) || !isIdentifier(node.expression))
|
|
73615
73741
|
return false;
|
|
@@ -73911,7 +74037,7 @@ ${lanes.join("\n")}
|
|
|
73911
74037
|
const { file, start, length: length2 } = diags[0];
|
|
73912
74038
|
diag2 = { file, start, length: length2, code: chain.code, category: chain.category, messageText: chain, relatedInformation: related };
|
|
73913
74039
|
} else {
|
|
73914
|
-
diag2 = createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, chain, related);
|
|
74040
|
+
diag2 = createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), getErrorNodeForCallNode(node), chain, related);
|
|
73915
74041
|
}
|
|
73916
74042
|
addImplementationSuccessElaboration(candidatesForArgumentError[0], diag2);
|
|
73917
74043
|
diagnostics.add(diag2);
|
|
@@ -74231,7 +74357,7 @@ ${lanes.join("\n")}
|
|
|
74231
74357
|
}
|
|
74232
74358
|
return resolveErrorCall(node);
|
|
74233
74359
|
}
|
|
74234
|
-
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(
|
|
74360
|
+
if (checkMode & 8 /* SkipGenericFunctions */ && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunctionOrConstructor)) {
|
|
74235
74361
|
skippedGenericFunction(node, checkMode);
|
|
74236
74362
|
return resolvingSignature;
|
|
74237
74363
|
}
|
|
@@ -74241,8 +74367,12 @@ ${lanes.join("\n")}
|
|
|
74241
74367
|
}
|
|
74242
74368
|
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, callChainFlags);
|
|
74243
74369
|
}
|
|
74244
|
-
function
|
|
74245
|
-
|
|
74370
|
+
function isGenericFunctionReturningFunctionOrConstructor(signature) {
|
|
74371
|
+
if (!signature.typeParameters) {
|
|
74372
|
+
return false;
|
|
74373
|
+
}
|
|
74374
|
+
const returnType = getReturnTypeOfSignature(signature);
|
|
74375
|
+
return isFunctionType(returnType) || isConstructorType(returnType);
|
|
74246
74376
|
}
|
|
74247
74377
|
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
|
|
74248
74378
|
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType);
|
|
@@ -74439,11 +74569,7 @@ ${lanes.join("\n")}
|
|
|
74439
74569
|
addRelatedInfo(diagnostic, createDiagnosticForNode(errorTarget, relatedInfo));
|
|
74440
74570
|
}
|
|
74441
74571
|
if (isCallExpression(errorTarget.parent)) {
|
|
74442
|
-
const { start, length: length2 } = getDiagnosticSpanForCallNode(
|
|
74443
|
-
errorTarget.parent,
|
|
74444
|
-
/*doNotIncludeArguments*/
|
|
74445
|
-
true
|
|
74446
|
-
);
|
|
74572
|
+
const { start, length: length2 } = getDiagnosticSpanForCallNode(errorTarget.parent);
|
|
74447
74573
|
diagnostic.start = start;
|
|
74448
74574
|
diagnostic.length = length2;
|
|
74449
74575
|
}
|
|
@@ -77813,16 +77939,19 @@ ${lanes.join("\n")}
|
|
|
77813
77939
|
}
|
|
77814
77940
|
}
|
|
77815
77941
|
}
|
|
77816
|
-
function
|
|
77942
|
+
function getNonGenericReturnTypeOfSingleCallSignature(funcType) {
|
|
77817
77943
|
const signature = getSingleCallSignature(funcType);
|
|
77818
|
-
if (signature
|
|
77819
|
-
|
|
77944
|
+
if (signature) {
|
|
77945
|
+
const returnType = getReturnTypeOfSignature(signature);
|
|
77946
|
+
if (!signature.typeParameters || !couldContainTypeVariables(returnType)) {
|
|
77947
|
+
return returnType;
|
|
77948
|
+
}
|
|
77820
77949
|
}
|
|
77821
77950
|
}
|
|
77822
77951
|
function getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) {
|
|
77823
77952
|
const funcType = checkExpression(expr.expression);
|
|
77824
77953
|
const nonOptionalType = getOptionalExpressionType(funcType, expr.expression);
|
|
77825
|
-
const returnType =
|
|
77954
|
+
const returnType = getNonGenericReturnTypeOfSingleCallSignature(funcType);
|
|
77826
77955
|
return returnType && propagateOptionalTypeMarker(returnType, expr, nonOptionalType !== funcType);
|
|
77827
77956
|
}
|
|
77828
77957
|
function getTypeOfExpression(node) {
|
|
@@ -77867,7 +77996,7 @@ ${lanes.join("\n")}
|
|
|
77867
77996
|
/*requireStringLiteralLikeArgument*/
|
|
77868
77997
|
true
|
|
77869
77998
|
) && !isSymbolOrSymbolForCall(expr)) {
|
|
77870
|
-
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) :
|
|
77999
|
+
return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getNonGenericReturnTypeOfSingleCallSignature(checkNonNullExpression(expr.expression));
|
|
77871
78000
|
} else if (isAssertionExpression(expr) && !isConstTypeReference(expr.type)) {
|
|
77872
78001
|
return getTypeFromTypeNode(expr.type);
|
|
77873
78002
|
} else if (isLiteralExpression(node) || isBooleanLiteral(node)) {
|
|
@@ -78739,7 +78868,8 @@ ${lanes.join("\n")}
|
|
|
78739
78868
|
}
|
|
78740
78869
|
const objectType = type.objectType;
|
|
78741
78870
|
const indexType = type.indexType;
|
|
78742
|
-
|
|
78871
|
+
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
78872
|
+
if (isTypeAssignableTo(indexType, objectIndexType)) {
|
|
78743
78873
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
78744
78874
|
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
78745
78875
|
}
|
|
@@ -136050,7 +136180,7 @@ ${lanes.join("\n")}
|
|
|
136050
136180
|
options
|
|
136051
136181
|
),
|
|
136052
136182
|
setExternalModuleIndicator: getSetExternalModuleIndicator(options),
|
|
136053
|
-
jsDocParsingMode: 1 /* ParseNone */
|
|
136183
|
+
jsDocParsingMode: transpileOptions.jsDocParsingMode ?? 1 /* ParseNone */
|
|
136054
136184
|
}
|
|
136055
136185
|
);
|
|
136056
136186
|
if (transpileOptions.moduleName) {
|
|
@@ -165147,6 +165277,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165147
165277
|
visitForDisplayParts(node.type);
|
|
165148
165278
|
}
|
|
165149
165279
|
break;
|
|
165280
|
+
case 181 /* IndexSignature */:
|
|
165281
|
+
Debug.assertNode(node, isIndexSignatureDeclaration);
|
|
165282
|
+
Debug.assertEqual(node.parameters.length, 1);
|
|
165283
|
+
parts.push({ text: "[" });
|
|
165284
|
+
visitForDisplayParts(node.parameters[0]);
|
|
165285
|
+
parts.push({ text: "]" });
|
|
165286
|
+
if (node.type) {
|
|
165287
|
+
parts.push({ text: ": " });
|
|
165288
|
+
visitForDisplayParts(node.type);
|
|
165289
|
+
}
|
|
165290
|
+
break;
|
|
165150
165291
|
case 173 /* MethodSignature */:
|
|
165151
165292
|
Debug.assertNode(node, isMethodSignature);
|
|
165152
165293
|
if ((_b = node.modifiers) == null ? void 0 : _b.length) {
|
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-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20231201`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -3105,6 +3105,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3105
3105
|
TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard";
|
|
3106
3106
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
3107
3107
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
3108
|
+
TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 268435456 /* StringMapping */] = "IncludesConstrainedTypeVariable";
|
|
3108
3109
|
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
3109
3110
|
return TypeFlags2;
|
|
3110
3111
|
})(TypeFlags || {});
|
|
@@ -3151,6 +3152,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
3151
3152
|
ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
|
|
3152
3153
|
ObjectFlags3[ObjectFlags3["IsNeverIntersectionComputed"] = 16777216] = "IsNeverIntersectionComputed";
|
|
3153
3154
|
ObjectFlags3[ObjectFlags3["IsNeverIntersection"] = 33554432] = "IsNeverIntersection";
|
|
3155
|
+
ObjectFlags3[ObjectFlags3["IsConstrainedTypeVariable"] = 67108864] = "IsConstrainedTypeVariable";
|
|
3154
3156
|
return ObjectFlags3;
|
|
3155
3157
|
})(ObjectFlags || {});
|
|
3156
3158
|
var SignatureFlags = /* @__PURE__ */ ((SignatureFlags4) => {
|
|
@@ -25706,7 +25708,7 @@ var libEntries = [
|
|
|
25706
25708
|
["esnext.disposable", "lib.esnext.disposable.d.ts"],
|
|
25707
25709
|
["esnext.bigint", "lib.es2020.bigint.d.ts"],
|
|
25708
25710
|
["esnext.string", "lib.es2022.string.d.ts"],
|
|
25709
|
-
["esnext.promise", "lib.
|
|
25711
|
+
["esnext.promise", "lib.esnext.promise.d.ts"],
|
|
25710
25712
|
["esnext.weakref", "lib.es2021.weakref.d.ts"],
|
|
25711
25713
|
["esnext.decorators", "lib.esnext.decorators.d.ts"],
|
|
25712
25714
|
["decorators", "lib.decorators.d.ts"],
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-dev.
|
|
5
|
+
"version": "5.4.0-dev.20231201",
|
|
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": "5bc66177388247d3e270653f94d82a8dabd56d69"
|
|
118
118
|
}
|