@typescript-deploys/pr-build 5.4.0-pr-57122-21 → 5.5.0-pr-57403-12
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 -21
- package/lib/tsserver.js +67 -32
- package/lib/typescript.d.ts +2 -1
- package/lib/typescript.js +66 -32
- package/lib/typingsInstaller.js +3 -2
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -17,8 +17,8 @@ and limitations under the License.
|
|
|
17
17
|
"use strict";
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
|
-
var versionMajorMinor = "5.
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
20
|
+
var versionMajorMinor = "5.5";
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240221`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3708,6 +3708,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
3708
3708
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
|
3709
3709
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
|
3710
3710
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
|
3711
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
3711
3712
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
3712
3713
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
3713
3714
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
|
@@ -48774,7 +48775,7 @@ function createTypeChecker(host) {
|
|
|
48774
48775
|
}
|
|
48775
48776
|
const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
|
|
48776
48777
|
if (some(abstractSignatures)) {
|
|
48777
|
-
const types = map(abstractSignatures, getOrCreateTypeFromSignature);
|
|
48778
|
+
const types = map(abstractSignatures, (s) => getOrCreateTypeFromSignature(s));
|
|
48778
48779
|
const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
|
|
48779
48780
|
// the logic in `createTypeNodesFromResolvedType`.
|
|
48780
48781
|
(context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
|
|
@@ -56168,6 +56169,12 @@ function createTypeChecker(host) {
|
|
|
56168
56169
|
isInJSFile(signature.declaration)
|
|
56169
56170
|
);
|
|
56170
56171
|
}
|
|
56172
|
+
function getImplementationSignature(signature) {
|
|
56173
|
+
return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
|
|
56174
|
+
}
|
|
56175
|
+
function createImplementationSignature(signature) {
|
|
56176
|
+
return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
|
|
56177
|
+
}
|
|
56171
56178
|
function getBaseSignature(signature) {
|
|
56172
56179
|
const typeParameters = signature.typeParameters;
|
|
56173
56180
|
if (typeParameters) {
|
|
@@ -56190,12 +56197,22 @@ function createTypeChecker(host) {
|
|
|
56190
56197
|
}
|
|
56191
56198
|
return signature;
|
|
56192
56199
|
}
|
|
56193
|
-
function getOrCreateTypeFromSignature(signature) {
|
|
56200
|
+
function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
|
|
56194
56201
|
var _a;
|
|
56195
56202
|
if (!signature.isolatedSignatureType) {
|
|
56196
56203
|
const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
|
|
56197
56204
|
const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
|
|
56198
|
-
const type = createObjectType(16 /* Anonymous */);
|
|
56205
|
+
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
|
|
56206
|
+
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
56207
|
+
type.symbol.declarations = [signature.declaration];
|
|
56208
|
+
type.symbol.valueDeclaration = signature.declaration;
|
|
56209
|
+
}
|
|
56210
|
+
outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
|
|
56211
|
+
signature.declaration,
|
|
56212
|
+
/*includeThisTypes*/
|
|
56213
|
+
true
|
|
56214
|
+
));
|
|
56215
|
+
type.outerTypeParameters = outerTypeParameters;
|
|
56199
56216
|
type.members = emptySymbols;
|
|
56200
56217
|
type.properties = emptyArray;
|
|
56201
56218
|
type.callSignatures = !isConstructor ? [signature] : emptyArray;
|
|
@@ -59588,7 +59605,7 @@ function createTypeChecker(host) {
|
|
|
59588
59605
|
const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
|
|
59589
59606
|
const links = getNodeLinks(declaration);
|
|
59590
59607
|
const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
59591
|
-
let typeParameters = links.outerTypeParameters;
|
|
59608
|
+
let typeParameters = type.objectFlags & 134217728 /* SingleSignatureType */ ? type.outerTypeParameters : links.outerTypeParameters;
|
|
59592
59609
|
if (!typeParameters) {
|
|
59593
59610
|
let outerTypeParameters = getOuterTypeParameters(
|
|
59594
59611
|
declaration,
|
|
@@ -59769,6 +59786,9 @@ function createTypeChecker(host) {
|
|
|
59769
59786
|
if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
|
|
59770
59787
|
result.node = type.node;
|
|
59771
59788
|
}
|
|
59789
|
+
if (type.objectFlags & 134217728 /* SingleSignatureType */) {
|
|
59790
|
+
result.outerTypeParameters = type.outerTypeParameters;
|
|
59791
|
+
}
|
|
59772
59792
|
result.target = type;
|
|
59773
59793
|
result.mapper = mapper;
|
|
59774
59794
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -64389,7 +64409,7 @@ function createTypeChecker(host) {
|
|
|
64389
64409
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
64390
64410
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
64391
64411
|
}
|
|
64392
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
64412
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 134217728 /* SingleSignatureType */ && !!length(type.outerTypeParameters) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
64393
64413
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
64394
64414
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
64395
64415
|
}
|
|
@@ -64671,6 +64691,9 @@ function createTypeChecker(host) {
|
|
|
64671
64691
|
pos = p;
|
|
64672
64692
|
}
|
|
64673
64693
|
}
|
|
64694
|
+
function isTupleOfSelf(typeParameter, type) {
|
|
64695
|
+
return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
|
|
64696
|
+
}
|
|
64674
64697
|
function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
|
64675
64698
|
let bivariant = false;
|
|
64676
64699
|
let propagationType;
|
|
@@ -64756,6 +64779,9 @@ function createTypeChecker(host) {
|
|
|
64756
64779
|
inference.priority = priority;
|
|
64757
64780
|
}
|
|
64758
64781
|
if (priority === inference.priority) {
|
|
64782
|
+
if (isTupleOfSelf(inference.typeParameter, candidate)) {
|
|
64783
|
+
return;
|
|
64784
|
+
}
|
|
64759
64785
|
if (contravariant && !bivariant) {
|
|
64760
64786
|
if (!contains(inference.contraCandidates, candidate)) {
|
|
64761
64787
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
|
@@ -65322,9 +65348,7 @@ function createTypeChecker(host) {
|
|
|
65322
65348
|
inferredType = silentNeverType;
|
|
65323
65349
|
} else {
|
|
65324
65350
|
const defaultType = getDefaultFromTypeParameter(inference.typeParameter);
|
|
65325
|
-
|
|
65326
|
-
inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
|
|
65327
|
-
}
|
|
65351
|
+
inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
|
|
65328
65352
|
}
|
|
65329
65353
|
} else {
|
|
65330
65354
|
inferredType = getTypeFromInference(inference);
|
|
@@ -71712,7 +71736,7 @@ function createTypeChecker(host) {
|
|
|
71712
71736
|
void 0,
|
|
71713
71737
|
checkMode
|
|
71714
71738
|
);
|
|
71715
|
-
const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
|
71739
|
+
const checkArgType = instantiateType(checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType, signature.mapper);
|
|
71716
71740
|
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
|
71717
71741
|
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
|
71718
71742
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
|
@@ -72256,13 +72280,16 @@ function createTypeChecker(host) {
|
|
|
72256
72280
|
return candidate;
|
|
72257
72281
|
}
|
|
72258
72282
|
for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
|
|
72259
|
-
|
|
72283
|
+
let candidate = candidates2[candidateIndex];
|
|
72260
72284
|
if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
|
72261
72285
|
continue;
|
|
72262
72286
|
}
|
|
72263
72287
|
let checkCandidate;
|
|
72264
72288
|
let inferenceContext;
|
|
72265
72289
|
if (candidate.typeParameters) {
|
|
72290
|
+
if (candidate.declaration && findAncestor(node, (a) => a === candidate.declaration)) {
|
|
72291
|
+
candidate = getImplementationSignature(candidate);
|
|
72292
|
+
}
|
|
72266
72293
|
let typeArgumentTypes;
|
|
72267
72294
|
if (some(typeArguments)) {
|
|
72268
72295
|
typeArgumentTypes = checkTypeArguments(
|
|
@@ -72282,7 +72309,7 @@ function createTypeChecker(host) {
|
|
|
72282
72309
|
/*flags*/
|
|
72283
72310
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
72284
72311
|
);
|
|
72285
|
-
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
72312
|
+
typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext), inferenceContext.nonFixingMapper);
|
|
72286
72313
|
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
72287
72314
|
}
|
|
72288
72315
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -72310,7 +72337,7 @@ function createTypeChecker(host) {
|
|
|
72310
72337
|
if (argCheckMode) {
|
|
72311
72338
|
argCheckMode = 0 /* Normal */;
|
|
72312
72339
|
if (inferenceContext) {
|
|
72313
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
72340
|
+
const typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext), inferenceContext.mapper);
|
|
72314
72341
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
72315
72342
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
72316
72343
|
candidateForArgumentArityError = checkCandidate;
|
|
@@ -76027,7 +76054,7 @@ function createTypeChecker(host) {
|
|
|
76027
76054
|
}
|
|
76028
76055
|
}
|
|
76029
76056
|
}
|
|
76030
|
-
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
|
|
76057
|
+
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context), flatMap(inferenceContexts, (c) => c && map(c.inferences, (i) => i.typeParameter)).slice());
|
|
76031
76058
|
}
|
|
76032
76059
|
}
|
|
76033
76060
|
}
|
|
@@ -77029,20 +77056,17 @@ function createTypeChecker(host) {
|
|
|
77029
77056
|
const objectType = type.objectType;
|
|
77030
77057
|
const indexType = type.indexType;
|
|
77031
77058
|
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
77032
|
-
|
|
77059
|
+
const hasNumberIndexInfo = !!getIndexInfoOfType(objectType, numberType);
|
|
77060
|
+
if (everyType(indexType, (t) => isTypeAssignableTo(t, objectIndexType) || hasNumberIndexInfo && isApplicableIndexType(t, numberType))) {
|
|
77033
77061
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
77034
77062
|
error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
77035
77063
|
}
|
|
77036
77064
|
return type;
|
|
77037
77065
|
}
|
|
77038
|
-
const apparentObjectType = getApparentType(objectType);
|
|
77039
|
-
if (getIndexInfoOfType(apparentObjectType, numberType) && isTypeAssignableToKind(indexType, 296 /* NumberLike */)) {
|
|
77040
|
-
return type;
|
|
77041
|
-
}
|
|
77042
77066
|
if (isGenericObjectType(objectType)) {
|
|
77043
77067
|
const propertyName = getPropertyNameFromIndex(indexType, accessNode);
|
|
77044
77068
|
if (propertyName) {
|
|
77045
|
-
const propertySymbol = forEachType(
|
|
77069
|
+
const propertySymbol = forEachType(getApparentType(objectType), (t) => getPropertyOfType(t, propertyName));
|
|
77046
77070
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 6 /* NonPublicAccessibilityModifier */) {
|
|
77047
77071
|
error(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
77048
77072
|
return errorType;
|
package/lib/tsserver.js
CHANGED
|
@@ -1231,6 +1231,7 @@ __export(server_exports, {
|
|
|
1231
1231
|
isBindingOrAssignmentPattern: () => isBindingOrAssignmentPattern,
|
|
1232
1232
|
isBindingPattern: () => isBindingPattern,
|
|
1233
1233
|
isBlock: () => isBlock,
|
|
1234
|
+
isBlockLike: () => isBlockLike,
|
|
1234
1235
|
isBlockOrCatchScoped: () => isBlockOrCatchScoped,
|
|
1235
1236
|
isBlockScope: () => isBlockScope,
|
|
1236
1237
|
isBlockScopedContainerTopLevel: () => isBlockScopedContainerTopLevel,
|
|
@@ -2339,8 +2340,8 @@ __export(server_exports, {
|
|
|
2339
2340
|
module.exports = __toCommonJS(server_exports);
|
|
2340
2341
|
|
|
2341
2342
|
// src/compiler/corePublic.ts
|
|
2342
|
-
var versionMajorMinor = "5.
|
|
2343
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2343
|
+
var versionMajorMinor = "5.5";
|
|
2344
|
+
var version = `${versionMajorMinor}.0-insiders.20240221`;
|
|
2344
2345
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2345
2346
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2346
2347
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6732,6 +6733,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
6732
6733
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
|
6733
6734
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
|
6734
6735
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
|
6736
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
6735
6737
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
6736
6738
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
6737
6739
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
|
@@ -53518,7 +53520,7 @@ function createTypeChecker(host) {
|
|
|
53518
53520
|
}
|
|
53519
53521
|
const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
|
|
53520
53522
|
if (some(abstractSignatures)) {
|
|
53521
|
-
const types = map(abstractSignatures, getOrCreateTypeFromSignature);
|
|
53523
|
+
const types = map(abstractSignatures, (s) => getOrCreateTypeFromSignature(s));
|
|
53522
53524
|
const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
|
|
53523
53525
|
// the logic in `createTypeNodesFromResolvedType`.
|
|
53524
53526
|
(context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
|
|
@@ -60912,6 +60914,12 @@ function createTypeChecker(host) {
|
|
|
60912
60914
|
isInJSFile(signature.declaration)
|
|
60913
60915
|
);
|
|
60914
60916
|
}
|
|
60917
|
+
function getImplementationSignature(signature) {
|
|
60918
|
+
return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
|
|
60919
|
+
}
|
|
60920
|
+
function createImplementationSignature(signature) {
|
|
60921
|
+
return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
|
|
60922
|
+
}
|
|
60915
60923
|
function getBaseSignature(signature) {
|
|
60916
60924
|
const typeParameters = signature.typeParameters;
|
|
60917
60925
|
if (typeParameters) {
|
|
@@ -60934,12 +60942,22 @@ function createTypeChecker(host) {
|
|
|
60934
60942
|
}
|
|
60935
60943
|
return signature;
|
|
60936
60944
|
}
|
|
60937
|
-
function getOrCreateTypeFromSignature(signature) {
|
|
60945
|
+
function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
|
|
60938
60946
|
var _a;
|
|
60939
60947
|
if (!signature.isolatedSignatureType) {
|
|
60940
60948
|
const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
|
|
60941
60949
|
const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
|
|
60942
|
-
const type = createObjectType(16 /* Anonymous */);
|
|
60950
|
+
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
|
|
60951
|
+
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
60952
|
+
type.symbol.declarations = [signature.declaration];
|
|
60953
|
+
type.symbol.valueDeclaration = signature.declaration;
|
|
60954
|
+
}
|
|
60955
|
+
outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
|
|
60956
|
+
signature.declaration,
|
|
60957
|
+
/*includeThisTypes*/
|
|
60958
|
+
true
|
|
60959
|
+
));
|
|
60960
|
+
type.outerTypeParameters = outerTypeParameters;
|
|
60943
60961
|
type.members = emptySymbols;
|
|
60944
60962
|
type.properties = emptyArray;
|
|
60945
60963
|
type.callSignatures = !isConstructor ? [signature] : emptyArray;
|
|
@@ -64332,7 +64350,7 @@ function createTypeChecker(host) {
|
|
|
64332
64350
|
const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
|
|
64333
64351
|
const links = getNodeLinks(declaration);
|
|
64334
64352
|
const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
64335
|
-
let typeParameters = links.outerTypeParameters;
|
|
64353
|
+
let typeParameters = type.objectFlags & 134217728 /* SingleSignatureType */ ? type.outerTypeParameters : links.outerTypeParameters;
|
|
64336
64354
|
if (!typeParameters) {
|
|
64337
64355
|
let outerTypeParameters = getOuterTypeParameters(
|
|
64338
64356
|
declaration,
|
|
@@ -64513,6 +64531,9 @@ function createTypeChecker(host) {
|
|
|
64513
64531
|
if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
|
|
64514
64532
|
result.node = type.node;
|
|
64515
64533
|
}
|
|
64534
|
+
if (type.objectFlags & 134217728 /* SingleSignatureType */) {
|
|
64535
|
+
result.outerTypeParameters = type.outerTypeParameters;
|
|
64536
|
+
}
|
|
64516
64537
|
result.target = type;
|
|
64517
64538
|
result.mapper = mapper;
|
|
64518
64539
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -69133,7 +69154,7 @@ function createTypeChecker(host) {
|
|
|
69133
69154
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
69134
69155
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
69135
69156
|
}
|
|
69136
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
69157
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 134217728 /* SingleSignatureType */ && !!length(type.outerTypeParameters) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
69137
69158
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
69138
69159
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
69139
69160
|
}
|
|
@@ -69415,6 +69436,9 @@ function createTypeChecker(host) {
|
|
|
69415
69436
|
pos = p;
|
|
69416
69437
|
}
|
|
69417
69438
|
}
|
|
69439
|
+
function isTupleOfSelf(typeParameter, type) {
|
|
69440
|
+
return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
|
|
69441
|
+
}
|
|
69418
69442
|
function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
|
69419
69443
|
let bivariant = false;
|
|
69420
69444
|
let propagationType;
|
|
@@ -69500,6 +69524,9 @@ function createTypeChecker(host) {
|
|
|
69500
69524
|
inference.priority = priority;
|
|
69501
69525
|
}
|
|
69502
69526
|
if (priority === inference.priority) {
|
|
69527
|
+
if (isTupleOfSelf(inference.typeParameter, candidate)) {
|
|
69528
|
+
return;
|
|
69529
|
+
}
|
|
69503
69530
|
if (contravariant && !bivariant) {
|
|
69504
69531
|
if (!contains(inference.contraCandidates, candidate)) {
|
|
69505
69532
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
|
@@ -70066,9 +70093,7 @@ function createTypeChecker(host) {
|
|
|
70066
70093
|
inferredType = silentNeverType;
|
|
70067
70094
|
} else {
|
|
70068
70095
|
const defaultType = getDefaultFromTypeParameter(inference.typeParameter);
|
|
70069
|
-
|
|
70070
|
-
inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
|
|
70071
|
-
}
|
|
70096
|
+
inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
|
|
70072
70097
|
}
|
|
70073
70098
|
} else {
|
|
70074
70099
|
inferredType = getTypeFromInference(inference);
|
|
@@ -76456,7 +76481,7 @@ function createTypeChecker(host) {
|
|
|
76456
76481
|
void 0,
|
|
76457
76482
|
checkMode
|
|
76458
76483
|
);
|
|
76459
|
-
const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
|
76484
|
+
const checkArgType = instantiateType(checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType, signature.mapper);
|
|
76460
76485
|
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
|
76461
76486
|
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
|
76462
76487
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
|
@@ -77000,13 +77025,16 @@ function createTypeChecker(host) {
|
|
|
77000
77025
|
return candidate;
|
|
77001
77026
|
}
|
|
77002
77027
|
for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
|
|
77003
|
-
|
|
77028
|
+
let candidate = candidates2[candidateIndex];
|
|
77004
77029
|
if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
|
77005
77030
|
continue;
|
|
77006
77031
|
}
|
|
77007
77032
|
let checkCandidate;
|
|
77008
77033
|
let inferenceContext;
|
|
77009
77034
|
if (candidate.typeParameters) {
|
|
77035
|
+
if (candidate.declaration && findAncestor(node, (a) => a === candidate.declaration)) {
|
|
77036
|
+
candidate = getImplementationSignature(candidate);
|
|
77037
|
+
}
|
|
77010
77038
|
let typeArgumentTypes;
|
|
77011
77039
|
if (some(typeArguments)) {
|
|
77012
77040
|
typeArgumentTypes = checkTypeArguments(
|
|
@@ -77026,7 +77054,7 @@ function createTypeChecker(host) {
|
|
|
77026
77054
|
/*flags*/
|
|
77027
77055
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
77028
77056
|
);
|
|
77029
|
-
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
77057
|
+
typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext), inferenceContext.nonFixingMapper);
|
|
77030
77058
|
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
77031
77059
|
}
|
|
77032
77060
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -77054,7 +77082,7 @@ function createTypeChecker(host) {
|
|
|
77054
77082
|
if (argCheckMode) {
|
|
77055
77083
|
argCheckMode = 0 /* Normal */;
|
|
77056
77084
|
if (inferenceContext) {
|
|
77057
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
77085
|
+
const typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext), inferenceContext.mapper);
|
|
77058
77086
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
77059
77087
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
77060
77088
|
candidateForArgumentArityError = checkCandidate;
|
|
@@ -80771,7 +80799,7 @@ function createTypeChecker(host) {
|
|
|
80771
80799
|
}
|
|
80772
80800
|
}
|
|
80773
80801
|
}
|
|
80774
|
-
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
|
|
80802
|
+
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context), flatMap(inferenceContexts, (c) => c && map(c.inferences, (i) => i.typeParameter)).slice());
|
|
80775
80803
|
}
|
|
80776
80804
|
}
|
|
80777
80805
|
}
|
|
@@ -81773,20 +81801,17 @@ function createTypeChecker(host) {
|
|
|
81773
81801
|
const objectType = type.objectType;
|
|
81774
81802
|
const indexType = type.indexType;
|
|
81775
81803
|
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
81776
|
-
|
|
81804
|
+
const hasNumberIndexInfo = !!getIndexInfoOfType(objectType, numberType);
|
|
81805
|
+
if (everyType(indexType, (t) => isTypeAssignableTo(t, objectIndexType) || hasNumberIndexInfo && isApplicableIndexType(t, numberType))) {
|
|
81777
81806
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
81778
81807
|
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
81779
81808
|
}
|
|
81780
81809
|
return type;
|
|
81781
81810
|
}
|
|
81782
|
-
const apparentObjectType = getApparentType(objectType);
|
|
81783
|
-
if (getIndexInfoOfType(apparentObjectType, numberType) && isTypeAssignableToKind(indexType, 296 /* NumberLike */)) {
|
|
81784
|
-
return type;
|
|
81785
|
-
}
|
|
81786
81811
|
if (isGenericObjectType(objectType)) {
|
|
81787
81812
|
const propertyName = getPropertyNameFromIndex(indexType, accessNode);
|
|
81788
81813
|
if (propertyName) {
|
|
81789
|
-
const propertySymbol = forEachType(
|
|
81814
|
+
const propertySymbol = forEachType(getApparentType(objectType), (t) => getPropertyOfType(t, propertyName));
|
|
81790
81815
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 6 /* NonPublicAccessibilityModifier */) {
|
|
81791
81816
|
error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
81792
81817
|
return errorType;
|
|
@@ -135473,6 +135498,17 @@ function fileShouldUseJavaScriptRequire(file, program, host, preferRequire) {
|
|
|
135473
135498
|
}
|
|
135474
135499
|
return preferRequire;
|
|
135475
135500
|
}
|
|
135501
|
+
function isBlockLike(node) {
|
|
135502
|
+
switch (node.kind) {
|
|
135503
|
+
case 241 /* Block */:
|
|
135504
|
+
case 312 /* SourceFile */:
|
|
135505
|
+
case 268 /* ModuleBlock */:
|
|
135506
|
+
case 296 /* CaseClause */:
|
|
135507
|
+
return true;
|
|
135508
|
+
default:
|
|
135509
|
+
return false;
|
|
135510
|
+
}
|
|
135511
|
+
}
|
|
135476
135512
|
|
|
135477
135513
|
// src/services/exportInfoMap.ts
|
|
135478
135514
|
var ImportKind = /* @__PURE__ */ ((ImportKind2) => {
|
|
@@ -140822,6 +140858,14 @@ registerRefactor(refactorNameForMoveToFile, {
|
|
|
140822
140858
|
if (!interactiveRefactorArguments) {
|
|
140823
140859
|
return emptyArray;
|
|
140824
140860
|
}
|
|
140861
|
+
if (context.endPosition !== void 0) {
|
|
140862
|
+
const file = context.file;
|
|
140863
|
+
const startNodeAncestor = findAncestor(getTokenAtPosition(file, context.startPosition), isBlockLike);
|
|
140864
|
+
const endNodeAncestor = findAncestor(getTokenAtPosition(file, context.endPosition), isBlockLike);
|
|
140865
|
+
if (startNodeAncestor && !isSourceFile(startNodeAncestor) && endNodeAncestor && !isSourceFile(endNodeAncestor)) {
|
|
140866
|
+
return emptyArray;
|
|
140867
|
+
}
|
|
140868
|
+
}
|
|
140825
140869
|
if (context.preferences.allowTextChangesInNewFiles && statements) {
|
|
140826
140870
|
return [{ name: refactorNameForMoveToFile, description: description2, actions: [moveToFileAction] }];
|
|
140827
140871
|
}
|
|
@@ -144899,17 +144943,6 @@ function isExtractableExpression(node) {
|
|
|
144899
144943
|
}
|
|
144900
144944
|
return true;
|
|
144901
144945
|
}
|
|
144902
|
-
function isBlockLike(node) {
|
|
144903
|
-
switch (node.kind) {
|
|
144904
|
-
case 241 /* Block */:
|
|
144905
|
-
case 312 /* SourceFile */:
|
|
144906
|
-
case 268 /* ModuleBlock */:
|
|
144907
|
-
case 296 /* CaseClause */:
|
|
144908
|
-
return true;
|
|
144909
|
-
default:
|
|
144910
|
-
return false;
|
|
144911
|
-
}
|
|
144912
|
-
}
|
|
144913
144946
|
function isInJSXContent(node) {
|
|
144914
144947
|
return isStringLiteralJsxAttribute(node) || (isJsxElement(node) || isJsxSelfClosingElement(node) || isJsxFragment(node)) && (isJsxElement(node.parent) || isJsxFragment(node.parent));
|
|
144915
144948
|
}
|
|
@@ -175659,6 +175692,7 @@ __export(ts_exports2, {
|
|
|
175659
175692
|
isBindingOrAssignmentPattern: () => isBindingOrAssignmentPattern,
|
|
175660
175693
|
isBindingPattern: () => isBindingPattern,
|
|
175661
175694
|
isBlock: () => isBlock,
|
|
175695
|
+
isBlockLike: () => isBlockLike,
|
|
175662
175696
|
isBlockOrCatchScoped: () => isBlockOrCatchScoped,
|
|
175663
175697
|
isBlockScope: () => isBlockScope,
|
|
175664
175698
|
isBlockScopedContainerTopLevel: () => isBlockScopedContainerTopLevel,
|
|
@@ -190483,6 +190517,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
190483
190517
|
isBindingOrAssignmentPattern,
|
|
190484
190518
|
isBindingPattern,
|
|
190485
190519
|
isBlock,
|
|
190520
|
+
isBlockLike,
|
|
190486
190521
|
isBlockOrCatchScoped,
|
|
190487
190522
|
isBlockScope,
|
|
190488
190523
|
isBlockScopedContainerTopLevel,
|
package/lib/typescript.d.ts
CHANGED
|
@@ -4139,7 +4139,7 @@ declare namespace ts {
|
|
|
4139
4139
|
responseRequired?: boolean;
|
|
4140
4140
|
}
|
|
4141
4141
|
}
|
|
4142
|
-
const versionMajorMinor = "5.
|
|
4142
|
+
const versionMajorMinor = "5.5";
|
|
4143
4143
|
/** The version of the TypeScript compiler release */
|
|
4144
4144
|
const version: string;
|
|
4145
4145
|
/**
|
|
@@ -7242,6 +7242,7 @@ declare namespace ts {
|
|
|
7242
7242
|
ContainsSpread = 2097152,
|
|
7243
7243
|
ObjectRestType = 4194304,
|
|
7244
7244
|
InstantiationExpressionType = 8388608,
|
|
7245
|
+
SingleSignatureType = 134217728,
|
|
7245
7246
|
}
|
|
7246
7247
|
interface ObjectType extends Type {
|
|
7247
7248
|
objectFlags: ObjectFlags;
|
package/lib/typescript.js
CHANGED
|
@@ -34,8 +34,8 @@ var ts = (() => {
|
|
|
34
34
|
var init_corePublic = __esm({
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
|
-
versionMajorMinor = "5.
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
37
|
+
versionMajorMinor = "5.5";
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20240221`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4485,6 +4485,7 @@ ${lanes.join("\n")}
|
|
|
4485
4485
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
|
4486
4486
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
|
4487
4487
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
|
4488
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
4488
4489
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
4489
4490
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
4490
4491
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
|
@@ -51273,7 +51274,7 @@ ${lanes.join("\n")}
|
|
|
51273
51274
|
}
|
|
51274
51275
|
const abstractSignatures = filter(resolved.constructSignatures, (signature) => !!(signature.flags & 4 /* Abstract */));
|
|
51275
51276
|
if (some(abstractSignatures)) {
|
|
51276
|
-
const types = map(abstractSignatures, getOrCreateTypeFromSignature);
|
|
51277
|
+
const types = map(abstractSignatures, (s) => getOrCreateTypeFromSignature(s));
|
|
51277
51278
|
const typeElementCount = resolved.callSignatures.length + (resolved.constructSignatures.length - abstractSignatures.length) + resolved.indexInfos.length + // exclude `prototype` when writing a class expression as a type literal, as per
|
|
51278
51279
|
// the logic in `createTypeNodesFromResolvedType`.
|
|
51279
51280
|
(context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ ? countWhere(resolved.properties, (p) => !(p.flags & 4194304 /* Prototype */)) : length(resolved.properties));
|
|
@@ -58667,6 +58668,12 @@ ${lanes.join("\n")}
|
|
|
58667
58668
|
isInJSFile(signature.declaration)
|
|
58668
58669
|
);
|
|
58669
58670
|
}
|
|
58671
|
+
function getImplementationSignature(signature) {
|
|
58672
|
+
return signature.typeParameters ? signature.implementationSignatureCache || (signature.implementationSignatureCache = createImplementationSignature(signature)) : signature;
|
|
58673
|
+
}
|
|
58674
|
+
function createImplementationSignature(signature) {
|
|
58675
|
+
return signature.typeParameters ? instantiateSignature(signature, createTypeMapper([], [])) : signature;
|
|
58676
|
+
}
|
|
58670
58677
|
function getBaseSignature(signature) {
|
|
58671
58678
|
const typeParameters = signature.typeParameters;
|
|
58672
58679
|
if (typeParameters) {
|
|
@@ -58689,12 +58696,22 @@ ${lanes.join("\n")}
|
|
|
58689
58696
|
}
|
|
58690
58697
|
return signature;
|
|
58691
58698
|
}
|
|
58692
|
-
function getOrCreateTypeFromSignature(signature) {
|
|
58699
|
+
function getOrCreateTypeFromSignature(signature, outerTypeParameters) {
|
|
58693
58700
|
var _a;
|
|
58694
58701
|
if (!signature.isolatedSignatureType) {
|
|
58695
58702
|
const kind = (_a = signature.declaration) == null ? void 0 : _a.kind;
|
|
58696
58703
|
const isConstructor = kind === void 0 || kind === 176 /* Constructor */ || kind === 180 /* ConstructSignature */ || kind === 185 /* ConstructorType */;
|
|
58697
|
-
const type = createObjectType(16 /* Anonymous */);
|
|
58704
|
+
const type = createObjectType(16 /* Anonymous */ | 134217728 /* SingleSignatureType */, createSymbol(16 /* Function */, "__function" /* Function */));
|
|
58705
|
+
if (signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
58706
|
+
type.symbol.declarations = [signature.declaration];
|
|
58707
|
+
type.symbol.valueDeclaration = signature.declaration;
|
|
58708
|
+
}
|
|
58709
|
+
outerTypeParameters || (outerTypeParameters = signature.declaration && getOuterTypeParameters(
|
|
58710
|
+
signature.declaration,
|
|
58711
|
+
/*includeThisTypes*/
|
|
58712
|
+
true
|
|
58713
|
+
));
|
|
58714
|
+
type.outerTypeParameters = outerTypeParameters;
|
|
58698
58715
|
type.members = emptySymbols;
|
|
58699
58716
|
type.properties = emptyArray;
|
|
58700
58717
|
type.callSignatures = !isConstructor ? [signature] : emptyArray;
|
|
@@ -62087,7 +62104,7 @@ ${lanes.join("\n")}
|
|
|
62087
62104
|
const declaration = type.objectFlags & 4 /* Reference */ ? type.node : type.objectFlags & 8388608 /* InstantiationExpressionType */ ? type.node : type.symbol.declarations[0];
|
|
62088
62105
|
const links = getNodeLinks(declaration);
|
|
62089
62106
|
const target = type.objectFlags & 4 /* Reference */ ? links.resolvedType : type.objectFlags & 64 /* Instantiated */ ? type.target : type;
|
|
62090
|
-
let typeParameters = links.outerTypeParameters;
|
|
62107
|
+
let typeParameters = type.objectFlags & 134217728 /* SingleSignatureType */ ? type.outerTypeParameters : links.outerTypeParameters;
|
|
62091
62108
|
if (!typeParameters) {
|
|
62092
62109
|
let outerTypeParameters = getOuterTypeParameters(
|
|
62093
62110
|
declaration,
|
|
@@ -62268,6 +62285,9 @@ ${lanes.join("\n")}
|
|
|
62268
62285
|
if (type.objectFlags & 8388608 /* InstantiationExpressionType */) {
|
|
62269
62286
|
result.node = type.node;
|
|
62270
62287
|
}
|
|
62288
|
+
if (type.objectFlags & 134217728 /* SingleSignatureType */) {
|
|
62289
|
+
result.outerTypeParameters = type.outerTypeParameters;
|
|
62290
|
+
}
|
|
62271
62291
|
result.target = type;
|
|
62272
62292
|
result.mapper = mapper;
|
|
62273
62293
|
result.aliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
@@ -66888,7 +66908,7 @@ ${lanes.join("\n")}
|
|
|
66888
66908
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
66889
66909
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
66890
66910
|
}
|
|
66891
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
66911
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 134217728 /* SingleSignatureType */ && !!length(type.outerTypeParameters) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
66892
66912
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
66893
66913
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
66894
66914
|
}
|
|
@@ -67170,6 +67190,9 @@ ${lanes.join("\n")}
|
|
|
67170
67190
|
pos = p;
|
|
67171
67191
|
}
|
|
67172
67192
|
}
|
|
67193
|
+
function isTupleOfSelf(typeParameter, type) {
|
|
67194
|
+
return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
|
|
67195
|
+
}
|
|
67173
67196
|
function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
|
|
67174
67197
|
let bivariant = false;
|
|
67175
67198
|
let propagationType;
|
|
@@ -67255,6 +67278,9 @@ ${lanes.join("\n")}
|
|
|
67255
67278
|
inference.priority = priority;
|
|
67256
67279
|
}
|
|
67257
67280
|
if (priority === inference.priority) {
|
|
67281
|
+
if (isTupleOfSelf(inference.typeParameter, candidate)) {
|
|
67282
|
+
return;
|
|
67283
|
+
}
|
|
67258
67284
|
if (contravariant && !bivariant) {
|
|
67259
67285
|
if (!contains(inference.contraCandidates, candidate)) {
|
|
67260
67286
|
inference.contraCandidates = append(inference.contraCandidates, candidate);
|
|
@@ -67821,9 +67847,7 @@ ${lanes.join("\n")}
|
|
|
67821
67847
|
inferredType = silentNeverType;
|
|
67822
67848
|
} else {
|
|
67823
67849
|
const defaultType = getDefaultFromTypeParameter(inference.typeParameter);
|
|
67824
|
-
|
|
67825
|
-
inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
|
|
67826
|
-
}
|
|
67850
|
+
inferredType = instantiateType(defaultType, mergeTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
|
|
67827
67851
|
}
|
|
67828
67852
|
} else {
|
|
67829
67853
|
inferredType = getTypeFromInference(inference);
|
|
@@ -74211,7 +74235,7 @@ ${lanes.join("\n")}
|
|
|
74211
74235
|
void 0,
|
|
74212
74236
|
checkMode
|
|
74213
74237
|
);
|
|
74214
|
-
const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
|
74238
|
+
const checkArgType = instantiateType(checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType, signature.mapper);
|
|
74215
74239
|
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
|
74216
74240
|
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
|
74217
74241
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
|
@@ -74755,13 +74779,16 @@ ${lanes.join("\n")}
|
|
|
74755
74779
|
return candidate;
|
|
74756
74780
|
}
|
|
74757
74781
|
for (let candidateIndex = 0; candidateIndex < candidates2.length; candidateIndex++) {
|
|
74758
|
-
|
|
74782
|
+
let candidate = candidates2[candidateIndex];
|
|
74759
74783
|
if (!hasCorrectTypeArgumentArity(candidate, typeArguments) || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma2)) {
|
|
74760
74784
|
continue;
|
|
74761
74785
|
}
|
|
74762
74786
|
let checkCandidate;
|
|
74763
74787
|
let inferenceContext;
|
|
74764
74788
|
if (candidate.typeParameters) {
|
|
74789
|
+
if (candidate.declaration && findAncestor(node, (a) => a === candidate.declaration)) {
|
|
74790
|
+
candidate = getImplementationSignature(candidate);
|
|
74791
|
+
}
|
|
74765
74792
|
let typeArgumentTypes;
|
|
74766
74793
|
if (some(typeArguments)) {
|
|
74767
74794
|
typeArgumentTypes = checkTypeArguments(
|
|
@@ -74781,7 +74808,7 @@ ${lanes.join("\n")}
|
|
|
74781
74808
|
/*flags*/
|
|
74782
74809
|
isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */
|
|
74783
74810
|
);
|
|
74784
|
-
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
74811
|
+
typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode | 8 /* SkipGenericFunctions */, inferenceContext), inferenceContext.nonFixingMapper);
|
|
74785
74812
|
argCheckMode |= inferenceContext.flags & 4 /* SkippedGenericFunction */ ? 8 /* SkipGenericFunctions */ : 0 /* Normal */;
|
|
74786
74813
|
}
|
|
74787
74814
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -74809,7 +74836,7 @@ ${lanes.join("\n")}
|
|
|
74809
74836
|
if (argCheckMode) {
|
|
74810
74837
|
argCheckMode = 0 /* Normal */;
|
|
74811
74838
|
if (inferenceContext) {
|
|
74812
|
-
const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
74839
|
+
const typeArgumentTypes = instantiateTypes(inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext), inferenceContext.mapper);
|
|
74813
74840
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
|
|
74814
74841
|
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma2)) {
|
|
74815
74842
|
candidateForArgumentArityError = checkCandidate;
|
|
@@ -78526,7 +78553,7 @@ ${lanes.join("\n")}
|
|
|
78526
78553
|
}
|
|
78527
78554
|
}
|
|
78528
78555
|
}
|
|
78529
|
-
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
|
|
78556
|
+
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context), flatMap(inferenceContexts, (c) => c && map(c.inferences, (i) => i.typeParameter)).slice());
|
|
78530
78557
|
}
|
|
78531
78558
|
}
|
|
78532
78559
|
}
|
|
@@ -79528,20 +79555,17 @@ ${lanes.join("\n")}
|
|
|
79528
79555
|
const objectType = type.objectType;
|
|
79529
79556
|
const indexType = type.indexType;
|
|
79530
79557
|
const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */);
|
|
79531
|
-
|
|
79558
|
+
const hasNumberIndexInfo = !!getIndexInfoOfType(objectType, numberType);
|
|
79559
|
+
if (everyType(indexType, (t) => isTypeAssignableTo(t, objectIndexType) || hasNumberIndexInfo && isApplicableIndexType(t, numberType))) {
|
|
79532
79560
|
if (accessNode.kind === 212 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
|
|
79533
79561
|
error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
|
|
79534
79562
|
}
|
|
79535
79563
|
return type;
|
|
79536
79564
|
}
|
|
79537
|
-
const apparentObjectType = getApparentType(objectType);
|
|
79538
|
-
if (getIndexInfoOfType(apparentObjectType, numberType) && isTypeAssignableToKind(indexType, 296 /* NumberLike */)) {
|
|
79539
|
-
return type;
|
|
79540
|
-
}
|
|
79541
79565
|
if (isGenericObjectType(objectType)) {
|
|
79542
79566
|
const propertyName = getPropertyNameFromIndex(indexType, accessNode);
|
|
79543
79567
|
if (propertyName) {
|
|
79544
|
-
const propertySymbol = forEachType(
|
|
79568
|
+
const propertySymbol = forEachType(getApparentType(objectType), (t) => getPropertyOfType(t, propertyName));
|
|
79545
79569
|
if (propertySymbol && getDeclarationModifierFlagsFromSymbol(propertySymbol) & 6 /* NonPublicAccessibilityModifier */) {
|
|
79546
79570
|
error2(accessNode, Diagnostics.Private_or_protected_member_0_cannot_be_accessed_on_a_type_parameter, unescapeLeadingUnderscores(propertyName));
|
|
79547
79571
|
return errorType;
|
|
@@ -133720,6 +133744,17 @@ ${lanes.join("\n")}
|
|
|
133720
133744
|
}
|
|
133721
133745
|
return preferRequire;
|
|
133722
133746
|
}
|
|
133747
|
+
function isBlockLike(node) {
|
|
133748
|
+
switch (node.kind) {
|
|
133749
|
+
case 241 /* Block */:
|
|
133750
|
+
case 312 /* SourceFile */:
|
|
133751
|
+
case 268 /* ModuleBlock */:
|
|
133752
|
+
case 296 /* CaseClause */:
|
|
133753
|
+
return true;
|
|
133754
|
+
default:
|
|
133755
|
+
return false;
|
|
133756
|
+
}
|
|
133757
|
+
}
|
|
133723
133758
|
var scanner, SemanticMeaning, tripleSlashDirectivePrefixRegex, typeKeywords, QuotePreference, displayPartWriter, lineFeed2, ANONYMOUS, syntaxMayBeASICandidate;
|
|
133724
133759
|
var init_utilities4 = __esm({
|
|
133725
133760
|
"src/services/utilities.ts"() {
|
|
@@ -140165,6 +140200,14 @@ ${lanes.join("\n")}
|
|
|
140165
140200
|
if (!interactiveRefactorArguments) {
|
|
140166
140201
|
return emptyArray;
|
|
140167
140202
|
}
|
|
140203
|
+
if (context.endPosition !== void 0) {
|
|
140204
|
+
const file = context.file;
|
|
140205
|
+
const startNodeAncestor = findAncestor(getTokenAtPosition(file, context.startPosition), isBlockLike);
|
|
140206
|
+
const endNodeAncestor = findAncestor(getTokenAtPosition(file, context.endPosition), isBlockLike);
|
|
140207
|
+
if (startNodeAncestor && !isSourceFile(startNodeAncestor) && endNodeAncestor && !isSourceFile(endNodeAncestor)) {
|
|
140208
|
+
return emptyArray;
|
|
140209
|
+
}
|
|
140210
|
+
}
|
|
140168
140211
|
if (context.preferences.allowTextChangesInNewFiles && statements) {
|
|
140169
140212
|
return [{ name: refactorNameForMoveToFile, description: description2, actions: [moveToFileAction] }];
|
|
140170
140213
|
}
|
|
@@ -143324,17 +143367,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
143324
143367
|
}
|
|
143325
143368
|
return true;
|
|
143326
143369
|
}
|
|
143327
|
-
function isBlockLike(node) {
|
|
143328
|
-
switch (node.kind) {
|
|
143329
|
-
case 241 /* Block */:
|
|
143330
|
-
case 312 /* SourceFile */:
|
|
143331
|
-
case 268 /* ModuleBlock */:
|
|
143332
|
-
case 296 /* CaseClause */:
|
|
143333
|
-
return true;
|
|
143334
|
-
default:
|
|
143335
|
-
return false;
|
|
143336
|
-
}
|
|
143337
|
-
}
|
|
143338
143370
|
function isInJSXContent(node) {
|
|
143339
143371
|
return isStringLiteralJsxAttribute(node) || (isJsxElement(node) || isJsxSelfClosingElement(node) || isJsxFragment(node)) && (isJsxElement(node.parent) || isJsxFragment(node.parent));
|
|
143340
143372
|
}
|
|
@@ -187245,6 +187277,7 @@ ${e.message}`;
|
|
|
187245
187277
|
isBindingOrAssignmentPattern: () => isBindingOrAssignmentPattern,
|
|
187246
187278
|
isBindingPattern: () => isBindingPattern,
|
|
187247
187279
|
isBlock: () => isBlock,
|
|
187280
|
+
isBlockLike: () => isBlockLike,
|
|
187248
187281
|
isBlockOrCatchScoped: () => isBlockOrCatchScoped,
|
|
187249
187282
|
isBlockScope: () => isBlockScope,
|
|
187250
187283
|
isBlockScopedContainerTopLevel: () => isBlockScopedContainerTopLevel,
|
|
@@ -189666,6 +189699,7 @@ ${e.message}`;
|
|
|
189666
189699
|
isBindingOrAssignmentPattern: () => isBindingOrAssignmentPattern,
|
|
189667
189700
|
isBindingPattern: () => isBindingPattern,
|
|
189668
189701
|
isBlock: () => isBlock,
|
|
189702
|
+
isBlockLike: () => isBlockLike,
|
|
189669
189703
|
isBlockOrCatchScoped: () => isBlockOrCatchScoped,
|
|
189670
189704
|
isBlockScope: () => isBlockScope,
|
|
189671
189705
|
isBlockScopedContainerTopLevel: () => isBlockScopedContainerTopLevel,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -53,8 +53,8 @@ var fs = __toESM(require("fs"));
|
|
|
53
53
|
var path = __toESM(require("path"));
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
|
-
var versionMajorMinor = "5.
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
56
|
+
var versionMajorMinor = "5.5";
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20240221`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -3142,6 +3142,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
3142
3142
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
|
3143
3143
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
|
3144
3144
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
|
3145
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
3145
3146
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
3146
3147
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
3147
3148
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
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.
|
|
5
|
+
"version": "5.5.0-pr-57403-12",
|
|
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": "70338f99ff0955fde9fe29b360c4bd685ac8d868"
|
|
118
118
|
}
|