typescript 5.4.0-dev.20240218 → 5.4.0-dev.20240220
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 +21 -15
- package/lib/tsserver.js +21 -15
- package/lib/typescript.js +21 -15
- package/lib/typingsInstaller.js +1 -1
- 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-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240220`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -55315,11 +55315,15 @@ function createTypeChecker(host) {
|
|
|
55315
55315
|
return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type));
|
|
55316
55316
|
}
|
|
55317
55317
|
function getResolvedApparentTypeOfMappedType(type) {
|
|
55318
|
-
const
|
|
55319
|
-
|
|
55320
|
-
|
|
55321
|
-
|
|
55322
|
-
|
|
55318
|
+
const target = type.target ?? type;
|
|
55319
|
+
const typeVariable = getHomomorphicTypeVariable(target);
|
|
55320
|
+
if (typeVariable && !target.declaration.nameType) {
|
|
55321
|
+
const constraint = getConstraintTypeFromMappedType(type);
|
|
55322
|
+
if (constraint.flags & 4194304 /* Index */) {
|
|
55323
|
+
const baseConstraint = getBaseConstraintOfType(constraint.type);
|
|
55324
|
+
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
|
|
55325
|
+
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
55326
|
+
}
|
|
55323
55327
|
}
|
|
55324
55328
|
}
|
|
55325
55329
|
return type;
|
|
@@ -60656,8 +60660,8 @@ function createTypeChecker(host) {
|
|
|
60656
60660
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
60657
60661
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
60658
60662
|
for (let i = 0; i < paramCount; i++) {
|
|
60659
|
-
const sourceType = i === restIndex ?
|
|
60660
|
-
const targetType = i === restIndex ?
|
|
60663
|
+
const sourceType = i === restIndex ? getRestOrAnyTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
60664
|
+
const targetType = i === restIndex ? getRestOrAnyTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
60661
60665
|
if (sourceType && targetType) {
|
|
60662
60666
|
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
60663
60667
|
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
@@ -73660,6 +73664,11 @@ function createTypeChecker(host) {
|
|
|
73660
73664
|
}
|
|
73661
73665
|
return createTupleType(types, flags, readonly, names);
|
|
73662
73666
|
}
|
|
73667
|
+
function getRestOrAnyTypeAtPosition(source, pos) {
|
|
73668
|
+
const restType = getRestTypeAtPosition(source, pos);
|
|
73669
|
+
const elementType = restType && getElementTypeOfArrayType(restType);
|
|
73670
|
+
return elementType && isTypeAny(elementType) ? anyType : restType;
|
|
73671
|
+
}
|
|
73663
73672
|
function getParameterCount(signature) {
|
|
73664
73673
|
const length2 = signature.parameters.length;
|
|
73665
73674
|
if (signatureHasRestParameter(signature)) {
|
|
@@ -73716,7 +73725,7 @@ function createTypeChecker(host) {
|
|
|
73716
73725
|
if (signatureHasRestParameter(signature)) {
|
|
73717
73726
|
const restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
|
|
73718
73727
|
if (!isTupleType(restType)) {
|
|
73719
|
-
return restType;
|
|
73728
|
+
return isTypeAny(restType) ? anyArrayType : restType;
|
|
73720
73729
|
}
|
|
73721
73730
|
if (restType.target.hasRestElement) {
|
|
73722
73731
|
return sliceTupleType(restType, restType.target.fixedLength);
|
|
@@ -77020,20 +77029,17 @@ function createTypeChecker(host) {
|
|
|
77020
77029
|
const objectType = type.objectType;
|
|
77021
77030
|
const indexType = type.indexType;
|
|
77022
77031
|
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
77023
|
-
|
|
77032
|
+
const hasNumberIndexInfo = !!getIndexInfoOfType(objectType, numberType);
|
|
77033
|
+
if (everyType(indexType, (t) => isTypeAssignableTo(t, objectIndexType) || hasNumberIndexInfo && isApplicableIndexType(t, numberType))) {
|
|
77024
77034
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
77025
77035
|
error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
77026
77036
|
}
|
|
77027
77037
|
return type;
|
|
77028
77038
|
}
|
|
77029
|
-
const apparentObjectType = getApparentType(objectType);
|
|
77030
|
-
if (getIndexInfoOfType(apparentObjectType, numberType) && isTypeAssignableToKind(indexType, 296 /* NumberLike */)) {
|
|
77031
|
-
return type;
|
|
77032
|
-
}
|
|
77033
77039
|
if (isGenericObjectType(objectType)) {
|
|
77034
77040
|
const propertyName = getPropertyNameFromIndex(indexType, accessNode);
|
|
77035
77041
|
if (propertyName) {
|
|
77036
|
-
const propertySymbol = forEachType(
|
|
77042
|
+
const propertySymbol = forEachType(getApparentType(objectType), (t) => getPropertyOfType(t, propertyName));
|
|
77037
77043
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 6 /* NonPublicAccessibilityModifier */) {
|
|
77038
77044
|
error(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
77039
77045
|
return errorType;
|
package/lib/tsserver.js
CHANGED
|
@@ -2340,7 +2340,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2340
2340
|
|
|
2341
2341
|
// src/compiler/corePublic.ts
|
|
2342
2342
|
var versionMajorMinor = "5.4";
|
|
2343
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2343
|
+
var version = `${versionMajorMinor}.0-dev.20240220`;
|
|
2344
2344
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2345
2345
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2346
2346
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -60059,11 +60059,15 @@ function createTypeChecker(host) {
|
|
|
60059
60059
|
return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type));
|
|
60060
60060
|
}
|
|
60061
60061
|
function getResolvedApparentTypeOfMappedType(type) {
|
|
60062
|
-
const
|
|
60063
|
-
|
|
60064
|
-
|
|
60065
|
-
|
|
60066
|
-
|
|
60062
|
+
const target = type.target ?? type;
|
|
60063
|
+
const typeVariable = getHomomorphicTypeVariable(target);
|
|
60064
|
+
if (typeVariable && !target.declaration.nameType) {
|
|
60065
|
+
const constraint = getConstraintTypeFromMappedType(type);
|
|
60066
|
+
if (constraint.flags & 4194304 /* Index */) {
|
|
60067
|
+
const baseConstraint = getBaseConstraintOfType(constraint.type);
|
|
60068
|
+
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
|
|
60069
|
+
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
60070
|
+
}
|
|
60067
60071
|
}
|
|
60068
60072
|
}
|
|
60069
60073
|
return type;
|
|
@@ -65400,8 +65404,8 @@ function createTypeChecker(host) {
|
|
|
65400
65404
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
65401
65405
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
65402
65406
|
for (let i = 0; i < paramCount; i++) {
|
|
65403
|
-
const sourceType = i === restIndex ?
|
|
65404
|
-
const targetType = i === restIndex ?
|
|
65407
|
+
const sourceType = i === restIndex ? getRestOrAnyTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
65408
|
+
const targetType = i === restIndex ? getRestOrAnyTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
65405
65409
|
if (sourceType && targetType) {
|
|
65406
65410
|
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
65407
65411
|
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
@@ -78404,6 +78408,11 @@ function createTypeChecker(host) {
|
|
|
78404
78408
|
}
|
|
78405
78409
|
return createTupleType(types, flags, readonly, names);
|
|
78406
78410
|
}
|
|
78411
|
+
function getRestOrAnyTypeAtPosition(source, pos) {
|
|
78412
|
+
const restType = getRestTypeAtPosition(source, pos);
|
|
78413
|
+
const elementType = restType && getElementTypeOfArrayType(restType);
|
|
78414
|
+
return elementType && isTypeAny(elementType) ? anyType : restType;
|
|
78415
|
+
}
|
|
78407
78416
|
function getParameterCount(signature) {
|
|
78408
78417
|
const length2 = signature.parameters.length;
|
|
78409
78418
|
if (signatureHasRestParameter(signature)) {
|
|
@@ -78460,7 +78469,7 @@ function createTypeChecker(host) {
|
|
|
78460
78469
|
if (signatureHasRestParameter(signature)) {
|
|
78461
78470
|
const restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
|
|
78462
78471
|
if (!isTupleType(restType)) {
|
|
78463
|
-
return restType;
|
|
78472
|
+
return isTypeAny(restType) ? anyArrayType : restType;
|
|
78464
78473
|
}
|
|
78465
78474
|
if (restType.target.hasRestElement) {
|
|
78466
78475
|
return sliceTupleType(restType, restType.target.fixedLength);
|
|
@@ -81764,20 +81773,17 @@ function createTypeChecker(host) {
|
|
|
81764
81773
|
const objectType = type.objectType;
|
|
81765
81774
|
const indexType = type.indexType;
|
|
81766
81775
|
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
81767
|
-
|
|
81776
|
+
const hasNumberIndexInfo = !!getIndexInfoOfType(objectType, numberType);
|
|
81777
|
+
if (everyType(indexType, (t) => isTypeAssignableTo(t, objectIndexType) || hasNumberIndexInfo && isApplicableIndexType(t, numberType))) {
|
|
81768
81778
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
81769
81779
|
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
81770
81780
|
}
|
|
81771
81781
|
return type;
|
|
81772
81782
|
}
|
|
81773
|
-
const apparentObjectType = getApparentType(objectType);
|
|
81774
|
-
if (getIndexInfoOfType(apparentObjectType, numberType) && isTypeAssignableToKind(indexType, 296 /* NumberLike */)) {
|
|
81775
|
-
return type;
|
|
81776
|
-
}
|
|
81777
81783
|
if (isGenericObjectType(objectType)) {
|
|
81778
81784
|
const propertyName = getPropertyNameFromIndex(indexType, accessNode);
|
|
81779
81785
|
if (propertyName) {
|
|
81780
|
-
const propertySymbol = forEachType(
|
|
81786
|
+
const propertySymbol = forEachType(getApparentType(objectType), (t) => getPropertyOfType(t, propertyName));
|
|
81781
81787
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 6 /* NonPublicAccessibilityModifier */) {
|
|
81782
81788
|
error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
81783
81789
|
return errorType;
|
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.20240220`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -57814,11 +57814,15 @@ ${lanes.join("\n")}
|
|
|
57814
57814
|
return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type));
|
|
57815
57815
|
}
|
|
57816
57816
|
function getResolvedApparentTypeOfMappedType(type) {
|
|
57817
|
-
const
|
|
57818
|
-
|
|
57819
|
-
|
|
57820
|
-
|
|
57821
|
-
|
|
57817
|
+
const target = type.target ?? type;
|
|
57818
|
+
const typeVariable = getHomomorphicTypeVariable(target);
|
|
57819
|
+
if (typeVariable && !target.declaration.nameType) {
|
|
57820
|
+
const constraint = getConstraintTypeFromMappedType(type);
|
|
57821
|
+
if (constraint.flags & 4194304 /* Index */) {
|
|
57822
|
+
const baseConstraint = getBaseConstraintOfType(constraint.type);
|
|
57823
|
+
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
|
|
57824
|
+
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
57825
|
+
}
|
|
57822
57826
|
}
|
|
57823
57827
|
}
|
|
57824
57828
|
return type;
|
|
@@ -63155,8 +63159,8 @@ ${lanes.join("\n")}
|
|
|
63155
63159
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
63156
63160
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
63157
63161
|
for (let i = 0; i < paramCount; i++) {
|
|
63158
|
-
const sourceType = i === restIndex ?
|
|
63159
|
-
const targetType = i === restIndex ?
|
|
63162
|
+
const sourceType = i === restIndex ? getRestOrAnyTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
63163
|
+
const targetType = i === restIndex ? getRestOrAnyTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
63160
63164
|
if (sourceType && targetType) {
|
|
63161
63165
|
const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
63162
63166
|
const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
@@ -76159,6 +76163,11 @@ ${lanes.join("\n")}
|
|
|
76159
76163
|
}
|
|
76160
76164
|
return createTupleType(types, flags, readonly, names);
|
|
76161
76165
|
}
|
|
76166
|
+
function getRestOrAnyTypeAtPosition(source, pos) {
|
|
76167
|
+
const restType = getRestTypeAtPosition(source, pos);
|
|
76168
|
+
const elementType = restType && getElementTypeOfArrayType(restType);
|
|
76169
|
+
return elementType && isTypeAny(elementType) ? anyType : restType;
|
|
76170
|
+
}
|
|
76162
76171
|
function getParameterCount(signature) {
|
|
76163
76172
|
const length2 = signature.parameters.length;
|
|
76164
76173
|
if (signatureHasRestParameter(signature)) {
|
|
@@ -76215,7 +76224,7 @@ ${lanes.join("\n")}
|
|
|
76215
76224
|
if (signatureHasRestParameter(signature)) {
|
|
76216
76225
|
const restType = getTypeOfSymbol(signature.parameters[signature.parameters.length - 1]);
|
|
76217
76226
|
if (!isTupleType(restType)) {
|
|
76218
|
-
return restType;
|
|
76227
|
+
return isTypeAny(restType) ? anyArrayType : restType;
|
|
76219
76228
|
}
|
|
76220
76229
|
if (restType.target.hasRestElement) {
|
|
76221
76230
|
return sliceTupleType(restType, restType.target.fixedLength);
|
|
@@ -79519,20 +79528,17 @@ ${lanes.join("\n")}
|
|
|
79519
79528
|
const objectType = type.objectType;
|
|
79520
79529
|
const indexType = type.indexType;
|
|
79521
79530
|
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
79522
|
-
|
|
79531
|
+
const hasNumberIndexInfo = !!getIndexInfoOfType(objectType, numberType);
|
|
79532
|
+
if (everyType(indexType, (t) => isTypeAssignableTo(t, objectIndexType) || hasNumberIndexInfo && isApplicableIndexType(t, numberType))) {
|
|
79523
79533
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
79524
79534
|
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
79525
79535
|
}
|
|
79526
79536
|
return type;
|
|
79527
79537
|
}
|
|
79528
|
-
const apparentObjectType = getApparentType(objectType);
|
|
79529
|
-
if (getIndexInfoOfType(apparentObjectType, numberType) && isTypeAssignableToKind(indexType, 296 /* NumberLike */)) {
|
|
79530
|
-
return type;
|
|
79531
|
-
}
|
|
79532
79538
|
if (isGenericObjectType(objectType)) {
|
|
79533
79539
|
const propertyName = getPropertyNameFromIndex(indexType, accessNode);
|
|
79534
79540
|
if (propertyName) {
|
|
79535
|
-
const propertySymbol = forEachType(
|
|
79541
|
+
const propertySymbol = forEachType(getApparentType(objectType), (t) => getPropertyOfType(t, propertyName));
|
|
79536
79542
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 6 /* NonPublicAccessibilityModifier */) {
|
|
79537
79543
|
error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
79538
79544
|
return errorType;
|
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.20240220`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
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.20240220",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "363abe8408ed2de0f3d7625c165e854e8284d18c"
|
|
117
117
|
}
|