@typescript-deploys/pr-build 5.3.0-pr-55793-6 → 5.3.0-pr-52972-6
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 +13 -22
- package/lib/tsserver.js +321 -33
- package/lib/typescript.js +322 -34
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -59704,16 +59704,8 @@ function createTypeChecker(host) {
|
|
|
59704
59704
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
59705
59705
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
59706
59706
|
for (let i = 0; i < paramCount; i++) {
|
|
59707
|
-
const sourceType = i === restIndex ?
|
|
59708
|
-
|
|
59709
|
-
/*forceVariadic*/
|
|
59710
|
-
false
|
|
59711
|
-
) : tryGetTypeAtPosition(source, i);
|
|
59712
|
-
const targetType = i === restIndex ? getMutableArrayOrTupleType(
|
|
59713
|
-
getRestTypeAtPosition(target, i),
|
|
59714
|
-
/*forceVariadic*/
|
|
59715
|
-
false
|
|
59716
|
-
) : tryGetTypeAtPosition(target, i);
|
|
59707
|
+
const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
59708
|
+
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
59717
59709
|
if (sourceType && targetType) {
|
|
59718
59710
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
59719
59711
|
const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
@@ -64068,10 +64060,13 @@ function createTypeChecker(host) {
|
|
|
64068
64060
|
if (sourceNameType && targetNameType)
|
|
64069
64061
|
inferFromTypes(sourceNameType, targetNameType);
|
|
64070
64062
|
}
|
|
64071
|
-
if (getObjectFlags(target) & 32 /* Mapped */
|
|
64072
|
-
const
|
|
64073
|
-
if (
|
|
64074
|
-
|
|
64063
|
+
if (getObjectFlags(target) & 32 /* Mapped */) {
|
|
64064
|
+
const mappedType = target;
|
|
64065
|
+
if (!getNameTypeFromMappedType(mappedType) || isFilteringMappedType(mappedType)) {
|
|
64066
|
+
const constraintType = getConstraintTypeFromMappedType(mappedType);
|
|
64067
|
+
if (inferToMappedType(source, mappedType, constraintType)) {
|
|
64068
|
+
return;
|
|
64069
|
+
}
|
|
64075
64070
|
}
|
|
64076
64071
|
}
|
|
64077
64072
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
@@ -70233,14 +70228,14 @@ function createTypeChecker(host) {
|
|
|
70233
70228
|
}
|
|
70234
70229
|
return getInferredTypes(context);
|
|
70235
70230
|
}
|
|
70236
|
-
function getMutableArrayOrTupleType(type
|
|
70237
|
-
return type.flags & 1048576 /* Union */ ? mapType(type,
|
|
70231
|
+
function getMutableArrayOrTupleType(type) {
|
|
70232
|
+
return type.flags & 1048576 /* Union */ ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 /* Any */ || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType(
|
|
70238
70233
|
getElementTypes(type),
|
|
70239
70234
|
type.target.elementFlags,
|
|
70240
70235
|
/*readonly*/
|
|
70241
70236
|
false,
|
|
70242
70237
|
type.target.labeledElementDeclarations
|
|
70243
|
-
) :
|
|
70238
|
+
) : createTupleType([type], [8 /* Variadic */]);
|
|
70244
70239
|
}
|
|
70245
70240
|
function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) {
|
|
70246
70241
|
const inConstContext = isConstTypeVariable(restType);
|
|
@@ -70249,11 +70244,7 @@ function createTypeChecker(host) {
|
|
|
70249
70244
|
if (isSpreadArgument(arg)) {
|
|
70250
70245
|
const spreadType = arg.kind === 237 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode);
|
|
70251
70246
|
if (isArrayLikeType(spreadType)) {
|
|
70252
|
-
return getMutableArrayOrTupleType(
|
|
70253
|
-
spreadType,
|
|
70254
|
-
/*forceVariadic*/
|
|
70255
|
-
true
|
|
70256
|
-
);
|
|
70247
|
+
return getMutableArrayOrTupleType(spreadType);
|
|
70257
70248
|
}
|
|
70258
70249
|
return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 230 /* SpreadElement */ ? arg.expression : arg), inConstContext);
|
|
70259
70250
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -64404,16 +64404,8 @@ function createTypeChecker(host) {
|
|
|
64404
64404
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
64405
64405
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
64406
64406
|
for (let i = 0; i < paramCount; i++) {
|
|
64407
|
-
const sourceType = i === restIndex ?
|
|
64408
|
-
|
|
64409
|
-
/*forceVariadic*/
|
|
64410
|
-
false
|
|
64411
|
-
) : tryGetTypeAtPosition(source, i);
|
|
64412
|
-
const targetType = i === restIndex ? getMutableArrayOrTupleType(
|
|
64413
|
-
getRestTypeAtPosition(target, i),
|
|
64414
|
-
/*forceVariadic*/
|
|
64415
|
-
false
|
|
64416
|
-
) : tryGetTypeAtPosition(target, i);
|
|
64407
|
+
const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
64408
|
+
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
64417
64409
|
if (sourceType && targetType) {
|
|
64418
64410
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
64419
64411
|
const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
@@ -68768,10 +68760,13 @@ function createTypeChecker(host) {
|
|
|
68768
68760
|
if (sourceNameType && targetNameType)
|
|
68769
68761
|
inferFromTypes(sourceNameType, targetNameType);
|
|
68770
68762
|
}
|
|
68771
|
-
if (getObjectFlags(target) & 32 /* Mapped */
|
|
68772
|
-
const
|
|
68773
|
-
if (
|
|
68774
|
-
|
|
68763
|
+
if (getObjectFlags(target) & 32 /* Mapped */) {
|
|
68764
|
+
const mappedType = target;
|
|
68765
|
+
if (!getNameTypeFromMappedType(mappedType) || isFilteringMappedType(mappedType)) {
|
|
68766
|
+
const constraintType = getConstraintTypeFromMappedType(mappedType);
|
|
68767
|
+
if (inferToMappedType(source, mappedType, constraintType)) {
|
|
68768
|
+
return;
|
|
68769
|
+
}
|
|
68775
68770
|
}
|
|
68776
68771
|
}
|
|
68777
68772
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
@@ -74933,14 +74928,14 @@ function createTypeChecker(host) {
|
|
|
74933
74928
|
}
|
|
74934
74929
|
return getInferredTypes(context);
|
|
74935
74930
|
}
|
|
74936
|
-
function getMutableArrayOrTupleType(type
|
|
74937
|
-
return type.flags & 1048576 /* Union */ ? mapType(type,
|
|
74931
|
+
function getMutableArrayOrTupleType(type) {
|
|
74932
|
+
return type.flags & 1048576 /* Union */ ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 /* Any */ || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType(
|
|
74938
74933
|
getElementTypes(type),
|
|
74939
74934
|
type.target.elementFlags,
|
|
74940
74935
|
/*readonly*/
|
|
74941
74936
|
false,
|
|
74942
74937
|
type.target.labeledElementDeclarations
|
|
74943
|
-
) :
|
|
74938
|
+
) : createTupleType([type], [8 /* Variadic */]);
|
|
74944
74939
|
}
|
|
74945
74940
|
function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) {
|
|
74946
74941
|
const inConstContext = isConstTypeVariable(restType);
|
|
@@ -74949,11 +74944,7 @@ function createTypeChecker(host) {
|
|
|
74949
74944
|
if (isSpreadArgument(arg)) {
|
|
74950
74945
|
const spreadType = arg.kind === 237 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode);
|
|
74951
74946
|
if (isArrayLikeType(spreadType)) {
|
|
74952
|
-
return getMutableArrayOrTupleType(
|
|
74953
|
-
spreadType,
|
|
74954
|
-
/*forceVariadic*/
|
|
74955
|
-
true
|
|
74956
|
-
);
|
|
74947
|
+
return getMutableArrayOrTupleType(spreadType);
|
|
74957
74948
|
}
|
|
74958
74949
|
return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 230 /* SpreadElement */ ? arg.expression : arg), inConstContext);
|
|
74959
74950
|
}
|
|
@@ -164892,7 +164883,6 @@ __export(ts_InlayHints_exports, {
|
|
|
164892
164883
|
});
|
|
164893
164884
|
|
|
164894
164885
|
// src/services/inlayHints.ts
|
|
164895
|
-
var maxTypeHintLength = 30;
|
|
164896
164886
|
var leadingParameterNameCommentRegexFactory = (name) => {
|
|
164897
164887
|
return new RegExp(`^\\s?/\\*\\*?\\s?${name}\\s?\\*\\/\\s?$`);
|
|
164898
164888
|
};
|
|
@@ -164972,9 +164962,10 @@ function provideInlayHints(context) {
|
|
|
164972
164962
|
displayParts
|
|
164973
164963
|
});
|
|
164974
164964
|
}
|
|
164975
|
-
function addTypeHints(
|
|
164965
|
+
function addTypeHints(hintText, position) {
|
|
164976
164966
|
result.push({
|
|
164977
|
-
text:
|
|
164967
|
+
text: typeof hintText === "string" ? `: ${hintText}` : "",
|
|
164968
|
+
displayParts: typeof hintText === "string" ? void 0 : [{ text: ": " }, ...hintText],
|
|
164978
164969
|
position,
|
|
164979
164970
|
kind: "Type" /* Type */,
|
|
164980
164971
|
whitespaceBefore: true
|
|
@@ -165012,13 +165003,14 @@ function provideInlayHints(context) {
|
|
|
165012
165003
|
if (isModuleReferenceType(declarationType)) {
|
|
165013
165004
|
return;
|
|
165014
165005
|
}
|
|
165015
|
-
const
|
|
165016
|
-
if (
|
|
165017
|
-
const
|
|
165006
|
+
const hints = typeToInlayHintParts(declarationType);
|
|
165007
|
+
if (hints) {
|
|
165008
|
+
const hintText = typeof hints === "string" ? hints : hints.map((part) => part.text).join("");
|
|
165009
|
+
const isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && equateStringsCaseInsensitive(decl.name.getText(), hintText);
|
|
165018
165010
|
if (isVariableNameMatchesType) {
|
|
165019
165011
|
return;
|
|
165020
165012
|
}
|
|
165021
|
-
addTypeHints(
|
|
165013
|
+
addTypeHints(hints, decl.name.end);
|
|
165022
165014
|
}
|
|
165023
165015
|
}
|
|
165024
165016
|
function visitCallOrNewExpression(expr) {
|
|
@@ -165126,11 +165118,10 @@ function provideInlayHints(context) {
|
|
|
165126
165118
|
if (isModuleReferenceType(returnType)) {
|
|
165127
165119
|
return;
|
|
165128
165120
|
}
|
|
165129
|
-
const
|
|
165130
|
-
if (
|
|
165131
|
-
|
|
165121
|
+
const hint = typeToInlayHintParts(returnType);
|
|
165122
|
+
if (hint) {
|
|
165123
|
+
addTypeHints(hint, getTypeAnnotationPosition(decl));
|
|
165132
165124
|
}
|
|
165133
|
-
addTypeHints(typeDisplayString, getTypeAnnotationPosition(decl));
|
|
165134
165125
|
}
|
|
165135
165126
|
function getTypeAnnotationPosition(decl) {
|
|
165136
165127
|
const closeParenToken = findChildOfKind(decl, 22 /* CloseParenToken */, file);
|
|
@@ -165191,6 +165182,303 @@ function provideInlayHints(context) {
|
|
|
165191
165182
|
);
|
|
165192
165183
|
});
|
|
165193
165184
|
}
|
|
165185
|
+
function typeToInlayHintParts(type) {
|
|
165186
|
+
if (!shouldUseInteractiveInlayHints(preferences)) {
|
|
165187
|
+
return printTypeInSingleLine(type);
|
|
165188
|
+
}
|
|
165189
|
+
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
165190
|
+
const typeNode = checker.typeToTypeNode(
|
|
165191
|
+
type,
|
|
165192
|
+
/*enclosingDeclaration*/
|
|
165193
|
+
void 0,
|
|
165194
|
+
flags
|
|
165195
|
+
);
|
|
165196
|
+
Debug.assertIsDefined(typeNode, "should always get typenode");
|
|
165197
|
+
const parts = [];
|
|
165198
|
+
visitForDisplayParts(typeNode);
|
|
165199
|
+
return parts;
|
|
165200
|
+
function visitForDisplayParts(node) {
|
|
165201
|
+
if (!node) {
|
|
165202
|
+
return;
|
|
165203
|
+
}
|
|
165204
|
+
const tokenString = tokenToString(node.kind);
|
|
165205
|
+
if (tokenString) {
|
|
165206
|
+
parts.push({ text: tokenString });
|
|
165207
|
+
return;
|
|
165208
|
+
}
|
|
165209
|
+
switch (node.kind) {
|
|
165210
|
+
case 80 /* Identifier */:
|
|
165211
|
+
const identifier = node;
|
|
165212
|
+
const identifierText = idText(identifier);
|
|
165213
|
+
const name = identifier.symbol && identifier.symbol.declarations && identifier.symbol.declarations.length && getNameOfDeclaration(identifier.symbol.declarations[0]);
|
|
165214
|
+
if (name) {
|
|
165215
|
+
parts.push(getNodeDisplayPart(identifierText, name));
|
|
165216
|
+
} else {
|
|
165217
|
+
parts.push({ text: identifierText });
|
|
165218
|
+
}
|
|
165219
|
+
break;
|
|
165220
|
+
case 9 /* NumericLiteral */:
|
|
165221
|
+
parts.push({ text: node.text });
|
|
165222
|
+
break;
|
|
165223
|
+
case 11 /* StringLiteral */:
|
|
165224
|
+
parts.push({ text: `"${node.text}"` });
|
|
165225
|
+
break;
|
|
165226
|
+
case 166 /* QualifiedName */:
|
|
165227
|
+
const qualifiedName = node;
|
|
165228
|
+
visitForDisplayParts(qualifiedName.left);
|
|
165229
|
+
parts.push({ text: "." });
|
|
165230
|
+
visitForDisplayParts(qualifiedName.right);
|
|
165231
|
+
break;
|
|
165232
|
+
case 182 /* TypePredicate */:
|
|
165233
|
+
const predicate = node;
|
|
165234
|
+
if (predicate.assertsModifier) {
|
|
165235
|
+
parts.push({ text: "asserts " });
|
|
165236
|
+
}
|
|
165237
|
+
visitForDisplayParts(predicate.parameterName);
|
|
165238
|
+
if (predicate.type) {
|
|
165239
|
+
parts.push({ text: " is " });
|
|
165240
|
+
visitForDisplayParts(predicate.type);
|
|
165241
|
+
}
|
|
165242
|
+
break;
|
|
165243
|
+
case 183 /* TypeReference */:
|
|
165244
|
+
const typeReference = node;
|
|
165245
|
+
visitForDisplayParts(typeReference.typeName);
|
|
165246
|
+
if (typeReference.typeArguments) {
|
|
165247
|
+
parts.push({ text: "<" });
|
|
165248
|
+
visitDisplayPartList(typeReference.typeArguments, ", ");
|
|
165249
|
+
parts.push({ text: ">" });
|
|
165250
|
+
}
|
|
165251
|
+
break;
|
|
165252
|
+
case 168 /* TypeParameter */:
|
|
165253
|
+
const typeParameter = node;
|
|
165254
|
+
if (typeParameter.modifiers) {
|
|
165255
|
+
visitDisplayPartList(typeParameter.modifiers, " ");
|
|
165256
|
+
}
|
|
165257
|
+
visitForDisplayParts(typeParameter.name);
|
|
165258
|
+
if (typeParameter.constraint) {
|
|
165259
|
+
parts.push({ text: " extends " });
|
|
165260
|
+
visitForDisplayParts(typeParameter.constraint);
|
|
165261
|
+
}
|
|
165262
|
+
if (typeParameter.default) {
|
|
165263
|
+
parts.push({ text: " = " });
|
|
165264
|
+
visitForDisplayParts(typeParameter.default);
|
|
165265
|
+
}
|
|
165266
|
+
break;
|
|
165267
|
+
case 169 /* Parameter */:
|
|
165268
|
+
const parameter = node;
|
|
165269
|
+
if (parameter.modifiers) {
|
|
165270
|
+
visitDisplayPartList(parameter.modifiers, " ");
|
|
165271
|
+
}
|
|
165272
|
+
if (parameter.dotDotDotToken) {
|
|
165273
|
+
parts.push({ text: "..." });
|
|
165274
|
+
}
|
|
165275
|
+
visitForDisplayParts(parameter.name);
|
|
165276
|
+
if (parameter.questionToken) {
|
|
165277
|
+
parts.push({ text: "?" });
|
|
165278
|
+
}
|
|
165279
|
+
if (parameter.type) {
|
|
165280
|
+
parts.push({ text: ": " });
|
|
165281
|
+
visitForDisplayParts(parameter.type);
|
|
165282
|
+
}
|
|
165283
|
+
break;
|
|
165284
|
+
case 185 /* ConstructorType */:
|
|
165285
|
+
const constructorType = node;
|
|
165286
|
+
parts.push({ text: "new " });
|
|
165287
|
+
if (constructorType.typeParameters) {
|
|
165288
|
+
parts.push({ text: "<" });
|
|
165289
|
+
visitDisplayPartList(constructorType.typeParameters, ", ");
|
|
165290
|
+
parts.push({ text: ">" });
|
|
165291
|
+
}
|
|
165292
|
+
parts.push({ text: "(" });
|
|
165293
|
+
visitDisplayPartList(constructorType.parameters, ", ");
|
|
165294
|
+
parts.push({ text: ")" });
|
|
165295
|
+
parts.push({ text: " => " });
|
|
165296
|
+
visitForDisplayParts(constructorType.type);
|
|
165297
|
+
break;
|
|
165298
|
+
case 186 /* TypeQuery */:
|
|
165299
|
+
const typeQuery = node;
|
|
165300
|
+
parts.push({ text: "typeof " });
|
|
165301
|
+
visitForDisplayParts(typeQuery.exprName);
|
|
165302
|
+
if (typeQuery.typeArguments) {
|
|
165303
|
+
parts.push({ text: "<" });
|
|
165304
|
+
visitDisplayPartList(typeQuery.typeArguments, ", ");
|
|
165305
|
+
parts.push({ text: ">" });
|
|
165306
|
+
}
|
|
165307
|
+
break;
|
|
165308
|
+
case 187 /* TypeLiteral */:
|
|
165309
|
+
const typeLiteral = node;
|
|
165310
|
+
parts.push({ text: "{" });
|
|
165311
|
+
if (typeLiteral.members.length) {
|
|
165312
|
+
parts.push({ text: " " });
|
|
165313
|
+
visitDisplayPartList(typeLiteral.members, "; ");
|
|
165314
|
+
parts.push({ text: " " });
|
|
165315
|
+
}
|
|
165316
|
+
parts.push({ text: "}" });
|
|
165317
|
+
break;
|
|
165318
|
+
case 188 /* ArrayType */:
|
|
165319
|
+
visitForDisplayParts(node.elementType);
|
|
165320
|
+
parts.push({ text: "[]" });
|
|
165321
|
+
break;
|
|
165322
|
+
case 189 /* TupleType */:
|
|
165323
|
+
parts.push({ text: "[" });
|
|
165324
|
+
visitDisplayPartList(node.elements, ", ");
|
|
165325
|
+
parts.push({ text: "]" });
|
|
165326
|
+
break;
|
|
165327
|
+
case 202 /* NamedTupleMember */:
|
|
165328
|
+
const member = node;
|
|
165329
|
+
if (member.dotDotDotToken) {
|
|
165330
|
+
parts.push({ text: "..." });
|
|
165331
|
+
}
|
|
165332
|
+
visitForDisplayParts(member.name);
|
|
165333
|
+
if (member.questionToken) {
|
|
165334
|
+
parts.push({ text: "?" });
|
|
165335
|
+
}
|
|
165336
|
+
parts.push({ text: ": " });
|
|
165337
|
+
visitForDisplayParts(member.type);
|
|
165338
|
+
break;
|
|
165339
|
+
case 190 /* OptionalType */:
|
|
165340
|
+
visitForDisplayParts(node.type);
|
|
165341
|
+
parts.push({ text: "?" });
|
|
165342
|
+
break;
|
|
165343
|
+
case 191 /* RestType */:
|
|
165344
|
+
parts.push({ text: "..." });
|
|
165345
|
+
visitForDisplayParts(node.type);
|
|
165346
|
+
break;
|
|
165347
|
+
case 192 /* UnionType */:
|
|
165348
|
+
visitDisplayPartList(node.types, " | ");
|
|
165349
|
+
break;
|
|
165350
|
+
case 193 /* IntersectionType */:
|
|
165351
|
+
visitDisplayPartList(node.types, " & ");
|
|
165352
|
+
break;
|
|
165353
|
+
case 194 /* ConditionalType */:
|
|
165354
|
+
const conditionalType = node;
|
|
165355
|
+
visitForDisplayParts(conditionalType.checkType);
|
|
165356
|
+
parts.push({ text: " extends " });
|
|
165357
|
+
visitForDisplayParts(conditionalType.extendsType);
|
|
165358
|
+
parts.push({ text: " ? " });
|
|
165359
|
+
visitForDisplayParts(conditionalType.trueType);
|
|
165360
|
+
parts.push({ text: " : " });
|
|
165361
|
+
visitForDisplayParts(conditionalType.falseType);
|
|
165362
|
+
break;
|
|
165363
|
+
case 195 /* InferType */:
|
|
165364
|
+
parts.push({ text: "infer " });
|
|
165365
|
+
visitForDisplayParts(node.typeParameter);
|
|
165366
|
+
break;
|
|
165367
|
+
case 196 /* ParenthesizedType */:
|
|
165368
|
+
parts.push({ text: "(" });
|
|
165369
|
+
visitForDisplayParts(node.type);
|
|
165370
|
+
parts.push({ text: ")" });
|
|
165371
|
+
break;
|
|
165372
|
+
case 198 /* TypeOperator */:
|
|
165373
|
+
const typeOperator = node;
|
|
165374
|
+
parts.push({ text: `${tokenToString(typeOperator.operator)} ` });
|
|
165375
|
+
visitForDisplayParts(typeOperator.type);
|
|
165376
|
+
break;
|
|
165377
|
+
case 199 /* IndexedAccessType */:
|
|
165378
|
+
const indexedAccess = node;
|
|
165379
|
+
visitForDisplayParts(indexedAccess.objectType);
|
|
165380
|
+
parts.push({ text: "[" });
|
|
165381
|
+
visitForDisplayParts(indexedAccess.indexType);
|
|
165382
|
+
parts.push({ text: "]" });
|
|
165383
|
+
break;
|
|
165384
|
+
case 200 /* MappedType */:
|
|
165385
|
+
const mappedType = node;
|
|
165386
|
+
parts.push({ text: "{ " });
|
|
165387
|
+
if (mappedType.readonlyToken) {
|
|
165388
|
+
if (mappedType.readonlyToken.kind === 40 /* PlusToken */) {
|
|
165389
|
+
parts.push({ text: "+" });
|
|
165390
|
+
} else if (mappedType.readonlyToken.kind === 41 /* MinusToken */) {
|
|
165391
|
+
parts.push({ text: "-" });
|
|
165392
|
+
}
|
|
165393
|
+
parts.push({ text: "readonly " });
|
|
165394
|
+
}
|
|
165395
|
+
parts.push({ text: "[" });
|
|
165396
|
+
visitForDisplayParts(mappedType.typeParameter);
|
|
165397
|
+
if (mappedType.nameType) {
|
|
165398
|
+
parts.push({ text: " as " });
|
|
165399
|
+
visitForDisplayParts(mappedType.nameType);
|
|
165400
|
+
}
|
|
165401
|
+
parts.push({ text: "]" });
|
|
165402
|
+
if (mappedType.questionToken) {
|
|
165403
|
+
if (mappedType.questionToken.kind === 40 /* PlusToken */) {
|
|
165404
|
+
parts.push({ text: "+" });
|
|
165405
|
+
} else if (mappedType.questionToken.kind === 41 /* MinusToken */) {
|
|
165406
|
+
parts.push({ text: "-" });
|
|
165407
|
+
}
|
|
165408
|
+
parts.push({ text: "?" });
|
|
165409
|
+
}
|
|
165410
|
+
parts.push({ text: ": " });
|
|
165411
|
+
if (mappedType.type) {
|
|
165412
|
+
visitForDisplayParts(mappedType.type);
|
|
165413
|
+
}
|
|
165414
|
+
parts.push({ text: "; }" });
|
|
165415
|
+
break;
|
|
165416
|
+
case 201 /* LiteralType */:
|
|
165417
|
+
visitForDisplayParts(node.literal);
|
|
165418
|
+
break;
|
|
165419
|
+
case 184 /* FunctionType */:
|
|
165420
|
+
const functionType = node;
|
|
165421
|
+
if (functionType.typeParameters) {
|
|
165422
|
+
parts.push({ text: "<" });
|
|
165423
|
+
visitDisplayPartList(functionType.typeParameters, ", ");
|
|
165424
|
+
parts.push({ text: ">" });
|
|
165425
|
+
}
|
|
165426
|
+
parts.push({ text: "(" });
|
|
165427
|
+
visitDisplayPartList(functionType.parameters, ", ");
|
|
165428
|
+
parts.push({ text: ")" });
|
|
165429
|
+
parts.push({ text: " => " });
|
|
165430
|
+
visitForDisplayParts(functionType.type);
|
|
165431
|
+
break;
|
|
165432
|
+
case 205 /* ImportType */:
|
|
165433
|
+
const importType = node;
|
|
165434
|
+
if (importType.isTypeOf) {
|
|
165435
|
+
parts.push({ text: "typeof " });
|
|
165436
|
+
}
|
|
165437
|
+
parts.push({ text: "import(" });
|
|
165438
|
+
visitForDisplayParts(importType.argument);
|
|
165439
|
+
if (importType.assertions) {
|
|
165440
|
+
parts.push({ text: ", { assert: " });
|
|
165441
|
+
visitDisplayPartList(importType.assertions.assertClause.elements, ", ");
|
|
165442
|
+
parts.push({ text: " }" });
|
|
165443
|
+
}
|
|
165444
|
+
parts.push({ text: ")" });
|
|
165445
|
+
if (importType.qualifier) {
|
|
165446
|
+
parts.push({ text: "." });
|
|
165447
|
+
visitForDisplayParts(importType.qualifier);
|
|
165448
|
+
}
|
|
165449
|
+
if (importType.typeArguments) {
|
|
165450
|
+
parts.push({ text: "<" });
|
|
165451
|
+
visitDisplayPartList(importType.typeArguments, ", ");
|
|
165452
|
+
parts.push({ text: ">" });
|
|
165453
|
+
}
|
|
165454
|
+
break;
|
|
165455
|
+
case 171 /* PropertySignature */:
|
|
165456
|
+
const propertySignature = node;
|
|
165457
|
+
if (propertySignature.modifiers) {
|
|
165458
|
+
visitDisplayPartList(propertySignature.modifiers, " ");
|
|
165459
|
+
}
|
|
165460
|
+
visitForDisplayParts(propertySignature.name);
|
|
165461
|
+
if (propertySignature.questionToken) {
|
|
165462
|
+
parts.push({ text: "?" });
|
|
165463
|
+
}
|
|
165464
|
+
if (propertySignature.type) {
|
|
165465
|
+
parts.push({ text: ": " });
|
|
165466
|
+
visitForDisplayParts(propertySignature.type);
|
|
165467
|
+
}
|
|
165468
|
+
break;
|
|
165469
|
+
default:
|
|
165470
|
+
Debug.failBadSyntaxKind(node);
|
|
165471
|
+
}
|
|
165472
|
+
}
|
|
165473
|
+
function visitDisplayPartList(nodes, separator) {
|
|
165474
|
+
nodes.forEach((node, index) => {
|
|
165475
|
+
if (index > 0) {
|
|
165476
|
+
parts.push({ text: separator });
|
|
165477
|
+
}
|
|
165478
|
+
visitForDisplayParts(node);
|
|
165479
|
+
});
|
|
165480
|
+
}
|
|
165481
|
+
}
|
|
165194
165482
|
function isUndefined(name) {
|
|
165195
165483
|
return name === "undefined";
|
|
165196
165484
|
}
|
package/lib/typescript.js
CHANGED
|
@@ -62170,16 +62170,8 @@ ${lanes.join("\n")}
|
|
|
62170
62170
|
const paramCount = sourceRestType || targetRestType ? Math.min(sourceCount, targetCount) : Math.max(sourceCount, targetCount);
|
|
62171
62171
|
const restIndex = sourceRestType || targetRestType ? paramCount - 1 : -1;
|
|
62172
62172
|
for (let i = 0; i < paramCount; i++) {
|
|
62173
|
-
const sourceType = i === restIndex ?
|
|
62174
|
-
|
|
62175
|
-
/*forceVariadic*/
|
|
62176
|
-
false
|
|
62177
|
-
) : tryGetTypeAtPosition(source, i);
|
|
62178
|
-
const targetType = i === restIndex ? getMutableArrayOrTupleType(
|
|
62179
|
-
getRestTypeAtPosition(target, i),
|
|
62180
|
-
/*forceVariadic*/
|
|
62181
|
-
false
|
|
62182
|
-
) : tryGetTypeAtPosition(target, i);
|
|
62173
|
+
const sourceType = i === restIndex ? getRestTypeAtPosition(source, i) : tryGetTypeAtPosition(source, i);
|
|
62174
|
+
const targetType = i === restIndex ? getRestTypeAtPosition(target, i) : tryGetTypeAtPosition(target, i);
|
|
62183
62175
|
if (sourceType && targetType) {
|
|
62184
62176
|
const sourceSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(sourceType));
|
|
62185
62177
|
const targetSig = checkMode & 3 /* Callback */ ? void 0 : getSingleCallSignature(getNonNullableType(targetType));
|
|
@@ -66534,10 +66526,13 @@ ${lanes.join("\n")}
|
|
|
66534
66526
|
if (sourceNameType && targetNameType)
|
|
66535
66527
|
inferFromTypes(sourceNameType, targetNameType);
|
|
66536
66528
|
}
|
|
66537
|
-
if (getObjectFlags(target) & 32 /* Mapped */
|
|
66538
|
-
const
|
|
66539
|
-
if (
|
|
66540
|
-
|
|
66529
|
+
if (getObjectFlags(target) & 32 /* Mapped */) {
|
|
66530
|
+
const mappedType = target;
|
|
66531
|
+
if (!getNameTypeFromMappedType(mappedType) || isFilteringMappedType(mappedType)) {
|
|
66532
|
+
const constraintType = getConstraintTypeFromMappedType(mappedType);
|
|
66533
|
+
if (inferToMappedType(source, mappedType, constraintType)) {
|
|
66534
|
+
return;
|
|
66535
|
+
}
|
|
66541
66536
|
}
|
|
66542
66537
|
}
|
|
66543
66538
|
if (!typesDefinitelyUnrelated(source, target)) {
|
|
@@ -72699,14 +72694,14 @@ ${lanes.join("\n")}
|
|
|
72699
72694
|
}
|
|
72700
72695
|
return getInferredTypes(context);
|
|
72701
72696
|
}
|
|
72702
|
-
function getMutableArrayOrTupleType(type
|
|
72703
|
-
return type.flags & 1048576 /* Union */ ? mapType(type,
|
|
72697
|
+
function getMutableArrayOrTupleType(type) {
|
|
72698
|
+
return type.flags & 1048576 /* Union */ ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 /* Any */ || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType(
|
|
72704
72699
|
getElementTypes(type),
|
|
72705
72700
|
type.target.elementFlags,
|
|
72706
72701
|
/*readonly*/
|
|
72707
72702
|
false,
|
|
72708
72703
|
type.target.labeledElementDeclarations
|
|
72709
|
-
) :
|
|
72704
|
+
) : createTupleType([type], [8 /* Variadic */]);
|
|
72710
72705
|
}
|
|
72711
72706
|
function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) {
|
|
72712
72707
|
const inConstContext = isConstTypeVariable(restType);
|
|
@@ -72715,11 +72710,7 @@ ${lanes.join("\n")}
|
|
|
72715
72710
|
if (isSpreadArgument(arg)) {
|
|
72716
72711
|
const spreadType = arg.kind === 237 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode);
|
|
72717
72712
|
if (isArrayLikeType(spreadType)) {
|
|
72718
|
-
return getMutableArrayOrTupleType(
|
|
72719
|
-
spreadType,
|
|
72720
|
-
/*forceVariadic*/
|
|
72721
|
-
true
|
|
72722
|
-
);
|
|
72713
|
+
return getMutableArrayOrTupleType(spreadType);
|
|
72723
72714
|
}
|
|
72724
72715
|
return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 230 /* SpreadElement */ ? arg.expression : arg), inConstContext);
|
|
72725
72716
|
}
|
|
@@ -164323,9 +164314,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164323
164314
|
displayParts
|
|
164324
164315
|
});
|
|
164325
164316
|
}
|
|
164326
|
-
function addTypeHints(
|
|
164317
|
+
function addTypeHints(hintText, position) {
|
|
164327
164318
|
result.push({
|
|
164328
|
-
text:
|
|
164319
|
+
text: typeof hintText === "string" ? `: ${hintText}` : "",
|
|
164320
|
+
displayParts: typeof hintText === "string" ? void 0 : [{ text: ": " }, ...hintText],
|
|
164329
164321
|
position,
|
|
164330
164322
|
kind: "Type" /* Type */,
|
|
164331
164323
|
whitespaceBefore: true
|
|
@@ -164363,13 +164355,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164363
164355
|
if (isModuleReferenceType(declarationType)) {
|
|
164364
164356
|
return;
|
|
164365
164357
|
}
|
|
164366
|
-
const
|
|
164367
|
-
if (
|
|
164368
|
-
const
|
|
164358
|
+
const hints = typeToInlayHintParts(declarationType);
|
|
164359
|
+
if (hints) {
|
|
164360
|
+
const hintText = typeof hints === "string" ? hints : hints.map((part) => part.text).join("");
|
|
164361
|
+
const isVariableNameMatchesType = preferences.includeInlayVariableTypeHintsWhenTypeMatchesName === false && equateStringsCaseInsensitive(decl.name.getText(), hintText);
|
|
164369
164362
|
if (isVariableNameMatchesType) {
|
|
164370
164363
|
return;
|
|
164371
164364
|
}
|
|
164372
|
-
addTypeHints(
|
|
164365
|
+
addTypeHints(hints, decl.name.end);
|
|
164373
164366
|
}
|
|
164374
164367
|
}
|
|
164375
164368
|
function visitCallOrNewExpression(expr) {
|
|
@@ -164477,11 +164470,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164477
164470
|
if (isModuleReferenceType(returnType)) {
|
|
164478
164471
|
return;
|
|
164479
164472
|
}
|
|
164480
|
-
const
|
|
164481
|
-
if (
|
|
164482
|
-
|
|
164473
|
+
const hint = typeToInlayHintParts(returnType);
|
|
164474
|
+
if (hint) {
|
|
164475
|
+
addTypeHints(hint, getTypeAnnotationPosition(decl));
|
|
164483
164476
|
}
|
|
164484
|
-
addTypeHints(typeDisplayString, getTypeAnnotationPosition(decl));
|
|
164485
164477
|
}
|
|
164486
164478
|
function getTypeAnnotationPosition(decl) {
|
|
164487
164479
|
const closeParenToken = findChildOfKind(decl, 22 /* CloseParenToken */, file);
|
|
@@ -164542,6 +164534,303 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164542
164534
|
);
|
|
164543
164535
|
});
|
|
164544
164536
|
}
|
|
164537
|
+
function typeToInlayHintParts(type) {
|
|
164538
|
+
if (!shouldUseInteractiveInlayHints(preferences)) {
|
|
164539
|
+
return printTypeInSingleLine(type);
|
|
164540
|
+
}
|
|
164541
|
+
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
164542
|
+
const typeNode = checker.typeToTypeNode(
|
|
164543
|
+
type,
|
|
164544
|
+
/*enclosingDeclaration*/
|
|
164545
|
+
void 0,
|
|
164546
|
+
flags
|
|
164547
|
+
);
|
|
164548
|
+
Debug.assertIsDefined(typeNode, "should always get typenode");
|
|
164549
|
+
const parts = [];
|
|
164550
|
+
visitForDisplayParts(typeNode);
|
|
164551
|
+
return parts;
|
|
164552
|
+
function visitForDisplayParts(node) {
|
|
164553
|
+
if (!node) {
|
|
164554
|
+
return;
|
|
164555
|
+
}
|
|
164556
|
+
const tokenString = tokenToString(node.kind);
|
|
164557
|
+
if (tokenString) {
|
|
164558
|
+
parts.push({ text: tokenString });
|
|
164559
|
+
return;
|
|
164560
|
+
}
|
|
164561
|
+
switch (node.kind) {
|
|
164562
|
+
case 80 /* Identifier */:
|
|
164563
|
+
const identifier = node;
|
|
164564
|
+
const identifierText = idText(identifier);
|
|
164565
|
+
const name = identifier.symbol && identifier.symbol.declarations && identifier.symbol.declarations.length && getNameOfDeclaration(identifier.symbol.declarations[0]);
|
|
164566
|
+
if (name) {
|
|
164567
|
+
parts.push(getNodeDisplayPart(identifierText, name));
|
|
164568
|
+
} else {
|
|
164569
|
+
parts.push({ text: identifierText });
|
|
164570
|
+
}
|
|
164571
|
+
break;
|
|
164572
|
+
case 9 /* NumericLiteral */:
|
|
164573
|
+
parts.push({ text: node.text });
|
|
164574
|
+
break;
|
|
164575
|
+
case 11 /* StringLiteral */:
|
|
164576
|
+
parts.push({ text: `"${node.text}"` });
|
|
164577
|
+
break;
|
|
164578
|
+
case 166 /* QualifiedName */:
|
|
164579
|
+
const qualifiedName = node;
|
|
164580
|
+
visitForDisplayParts(qualifiedName.left);
|
|
164581
|
+
parts.push({ text: "." });
|
|
164582
|
+
visitForDisplayParts(qualifiedName.right);
|
|
164583
|
+
break;
|
|
164584
|
+
case 182 /* TypePredicate */:
|
|
164585
|
+
const predicate = node;
|
|
164586
|
+
if (predicate.assertsModifier) {
|
|
164587
|
+
parts.push({ text: "asserts " });
|
|
164588
|
+
}
|
|
164589
|
+
visitForDisplayParts(predicate.parameterName);
|
|
164590
|
+
if (predicate.type) {
|
|
164591
|
+
parts.push({ text: " is " });
|
|
164592
|
+
visitForDisplayParts(predicate.type);
|
|
164593
|
+
}
|
|
164594
|
+
break;
|
|
164595
|
+
case 183 /* TypeReference */:
|
|
164596
|
+
const typeReference = node;
|
|
164597
|
+
visitForDisplayParts(typeReference.typeName);
|
|
164598
|
+
if (typeReference.typeArguments) {
|
|
164599
|
+
parts.push({ text: "<" });
|
|
164600
|
+
visitDisplayPartList(typeReference.typeArguments, ", ");
|
|
164601
|
+
parts.push({ text: ">" });
|
|
164602
|
+
}
|
|
164603
|
+
break;
|
|
164604
|
+
case 168 /* TypeParameter */:
|
|
164605
|
+
const typeParameter = node;
|
|
164606
|
+
if (typeParameter.modifiers) {
|
|
164607
|
+
visitDisplayPartList(typeParameter.modifiers, " ");
|
|
164608
|
+
}
|
|
164609
|
+
visitForDisplayParts(typeParameter.name);
|
|
164610
|
+
if (typeParameter.constraint) {
|
|
164611
|
+
parts.push({ text: " extends " });
|
|
164612
|
+
visitForDisplayParts(typeParameter.constraint);
|
|
164613
|
+
}
|
|
164614
|
+
if (typeParameter.default) {
|
|
164615
|
+
parts.push({ text: " = " });
|
|
164616
|
+
visitForDisplayParts(typeParameter.default);
|
|
164617
|
+
}
|
|
164618
|
+
break;
|
|
164619
|
+
case 169 /* Parameter */:
|
|
164620
|
+
const parameter = node;
|
|
164621
|
+
if (parameter.modifiers) {
|
|
164622
|
+
visitDisplayPartList(parameter.modifiers, " ");
|
|
164623
|
+
}
|
|
164624
|
+
if (parameter.dotDotDotToken) {
|
|
164625
|
+
parts.push({ text: "..." });
|
|
164626
|
+
}
|
|
164627
|
+
visitForDisplayParts(parameter.name);
|
|
164628
|
+
if (parameter.questionToken) {
|
|
164629
|
+
parts.push({ text: "?" });
|
|
164630
|
+
}
|
|
164631
|
+
if (parameter.type) {
|
|
164632
|
+
parts.push({ text: ": " });
|
|
164633
|
+
visitForDisplayParts(parameter.type);
|
|
164634
|
+
}
|
|
164635
|
+
break;
|
|
164636
|
+
case 185 /* ConstructorType */:
|
|
164637
|
+
const constructorType = node;
|
|
164638
|
+
parts.push({ text: "new " });
|
|
164639
|
+
if (constructorType.typeParameters) {
|
|
164640
|
+
parts.push({ text: "<" });
|
|
164641
|
+
visitDisplayPartList(constructorType.typeParameters, ", ");
|
|
164642
|
+
parts.push({ text: ">" });
|
|
164643
|
+
}
|
|
164644
|
+
parts.push({ text: "(" });
|
|
164645
|
+
visitDisplayPartList(constructorType.parameters, ", ");
|
|
164646
|
+
parts.push({ text: ")" });
|
|
164647
|
+
parts.push({ text: " => " });
|
|
164648
|
+
visitForDisplayParts(constructorType.type);
|
|
164649
|
+
break;
|
|
164650
|
+
case 186 /* TypeQuery */:
|
|
164651
|
+
const typeQuery = node;
|
|
164652
|
+
parts.push({ text: "typeof " });
|
|
164653
|
+
visitForDisplayParts(typeQuery.exprName);
|
|
164654
|
+
if (typeQuery.typeArguments) {
|
|
164655
|
+
parts.push({ text: "<" });
|
|
164656
|
+
visitDisplayPartList(typeQuery.typeArguments, ", ");
|
|
164657
|
+
parts.push({ text: ">" });
|
|
164658
|
+
}
|
|
164659
|
+
break;
|
|
164660
|
+
case 187 /* TypeLiteral */:
|
|
164661
|
+
const typeLiteral = node;
|
|
164662
|
+
parts.push({ text: "{" });
|
|
164663
|
+
if (typeLiteral.members.length) {
|
|
164664
|
+
parts.push({ text: " " });
|
|
164665
|
+
visitDisplayPartList(typeLiteral.members, "; ");
|
|
164666
|
+
parts.push({ text: " " });
|
|
164667
|
+
}
|
|
164668
|
+
parts.push({ text: "}" });
|
|
164669
|
+
break;
|
|
164670
|
+
case 188 /* ArrayType */:
|
|
164671
|
+
visitForDisplayParts(node.elementType);
|
|
164672
|
+
parts.push({ text: "[]" });
|
|
164673
|
+
break;
|
|
164674
|
+
case 189 /* TupleType */:
|
|
164675
|
+
parts.push({ text: "[" });
|
|
164676
|
+
visitDisplayPartList(node.elements, ", ");
|
|
164677
|
+
parts.push({ text: "]" });
|
|
164678
|
+
break;
|
|
164679
|
+
case 202 /* NamedTupleMember */:
|
|
164680
|
+
const member = node;
|
|
164681
|
+
if (member.dotDotDotToken) {
|
|
164682
|
+
parts.push({ text: "..." });
|
|
164683
|
+
}
|
|
164684
|
+
visitForDisplayParts(member.name);
|
|
164685
|
+
if (member.questionToken) {
|
|
164686
|
+
parts.push({ text: "?" });
|
|
164687
|
+
}
|
|
164688
|
+
parts.push({ text: ": " });
|
|
164689
|
+
visitForDisplayParts(member.type);
|
|
164690
|
+
break;
|
|
164691
|
+
case 190 /* OptionalType */:
|
|
164692
|
+
visitForDisplayParts(node.type);
|
|
164693
|
+
parts.push({ text: "?" });
|
|
164694
|
+
break;
|
|
164695
|
+
case 191 /* RestType */:
|
|
164696
|
+
parts.push({ text: "..." });
|
|
164697
|
+
visitForDisplayParts(node.type);
|
|
164698
|
+
break;
|
|
164699
|
+
case 192 /* UnionType */:
|
|
164700
|
+
visitDisplayPartList(node.types, " | ");
|
|
164701
|
+
break;
|
|
164702
|
+
case 193 /* IntersectionType */:
|
|
164703
|
+
visitDisplayPartList(node.types, " & ");
|
|
164704
|
+
break;
|
|
164705
|
+
case 194 /* ConditionalType */:
|
|
164706
|
+
const conditionalType = node;
|
|
164707
|
+
visitForDisplayParts(conditionalType.checkType);
|
|
164708
|
+
parts.push({ text: " extends " });
|
|
164709
|
+
visitForDisplayParts(conditionalType.extendsType);
|
|
164710
|
+
parts.push({ text: " ? " });
|
|
164711
|
+
visitForDisplayParts(conditionalType.trueType);
|
|
164712
|
+
parts.push({ text: " : " });
|
|
164713
|
+
visitForDisplayParts(conditionalType.falseType);
|
|
164714
|
+
break;
|
|
164715
|
+
case 195 /* InferType */:
|
|
164716
|
+
parts.push({ text: "infer " });
|
|
164717
|
+
visitForDisplayParts(node.typeParameter);
|
|
164718
|
+
break;
|
|
164719
|
+
case 196 /* ParenthesizedType */:
|
|
164720
|
+
parts.push({ text: "(" });
|
|
164721
|
+
visitForDisplayParts(node.type);
|
|
164722
|
+
parts.push({ text: ")" });
|
|
164723
|
+
break;
|
|
164724
|
+
case 198 /* TypeOperator */:
|
|
164725
|
+
const typeOperator = node;
|
|
164726
|
+
parts.push({ text: `${tokenToString(typeOperator.operator)} ` });
|
|
164727
|
+
visitForDisplayParts(typeOperator.type);
|
|
164728
|
+
break;
|
|
164729
|
+
case 199 /* IndexedAccessType */:
|
|
164730
|
+
const indexedAccess = node;
|
|
164731
|
+
visitForDisplayParts(indexedAccess.objectType);
|
|
164732
|
+
parts.push({ text: "[" });
|
|
164733
|
+
visitForDisplayParts(indexedAccess.indexType);
|
|
164734
|
+
parts.push({ text: "]" });
|
|
164735
|
+
break;
|
|
164736
|
+
case 200 /* MappedType */:
|
|
164737
|
+
const mappedType = node;
|
|
164738
|
+
parts.push({ text: "{ " });
|
|
164739
|
+
if (mappedType.readonlyToken) {
|
|
164740
|
+
if (mappedType.readonlyToken.kind === 40 /* PlusToken */) {
|
|
164741
|
+
parts.push({ text: "+" });
|
|
164742
|
+
} else if (mappedType.readonlyToken.kind === 41 /* MinusToken */) {
|
|
164743
|
+
parts.push({ text: "-" });
|
|
164744
|
+
}
|
|
164745
|
+
parts.push({ text: "readonly " });
|
|
164746
|
+
}
|
|
164747
|
+
parts.push({ text: "[" });
|
|
164748
|
+
visitForDisplayParts(mappedType.typeParameter);
|
|
164749
|
+
if (mappedType.nameType) {
|
|
164750
|
+
parts.push({ text: " as " });
|
|
164751
|
+
visitForDisplayParts(mappedType.nameType);
|
|
164752
|
+
}
|
|
164753
|
+
parts.push({ text: "]" });
|
|
164754
|
+
if (mappedType.questionToken) {
|
|
164755
|
+
if (mappedType.questionToken.kind === 40 /* PlusToken */) {
|
|
164756
|
+
parts.push({ text: "+" });
|
|
164757
|
+
} else if (mappedType.questionToken.kind === 41 /* MinusToken */) {
|
|
164758
|
+
parts.push({ text: "-" });
|
|
164759
|
+
}
|
|
164760
|
+
parts.push({ text: "?" });
|
|
164761
|
+
}
|
|
164762
|
+
parts.push({ text: ": " });
|
|
164763
|
+
if (mappedType.type) {
|
|
164764
|
+
visitForDisplayParts(mappedType.type);
|
|
164765
|
+
}
|
|
164766
|
+
parts.push({ text: "; }" });
|
|
164767
|
+
break;
|
|
164768
|
+
case 201 /* LiteralType */:
|
|
164769
|
+
visitForDisplayParts(node.literal);
|
|
164770
|
+
break;
|
|
164771
|
+
case 184 /* FunctionType */:
|
|
164772
|
+
const functionType = node;
|
|
164773
|
+
if (functionType.typeParameters) {
|
|
164774
|
+
parts.push({ text: "<" });
|
|
164775
|
+
visitDisplayPartList(functionType.typeParameters, ", ");
|
|
164776
|
+
parts.push({ text: ">" });
|
|
164777
|
+
}
|
|
164778
|
+
parts.push({ text: "(" });
|
|
164779
|
+
visitDisplayPartList(functionType.parameters, ", ");
|
|
164780
|
+
parts.push({ text: ")" });
|
|
164781
|
+
parts.push({ text: " => " });
|
|
164782
|
+
visitForDisplayParts(functionType.type);
|
|
164783
|
+
break;
|
|
164784
|
+
case 205 /* ImportType */:
|
|
164785
|
+
const importType = node;
|
|
164786
|
+
if (importType.isTypeOf) {
|
|
164787
|
+
parts.push({ text: "typeof " });
|
|
164788
|
+
}
|
|
164789
|
+
parts.push({ text: "import(" });
|
|
164790
|
+
visitForDisplayParts(importType.argument);
|
|
164791
|
+
if (importType.assertions) {
|
|
164792
|
+
parts.push({ text: ", { assert: " });
|
|
164793
|
+
visitDisplayPartList(importType.assertions.assertClause.elements, ", ");
|
|
164794
|
+
parts.push({ text: " }" });
|
|
164795
|
+
}
|
|
164796
|
+
parts.push({ text: ")" });
|
|
164797
|
+
if (importType.qualifier) {
|
|
164798
|
+
parts.push({ text: "." });
|
|
164799
|
+
visitForDisplayParts(importType.qualifier);
|
|
164800
|
+
}
|
|
164801
|
+
if (importType.typeArguments) {
|
|
164802
|
+
parts.push({ text: "<" });
|
|
164803
|
+
visitDisplayPartList(importType.typeArguments, ", ");
|
|
164804
|
+
parts.push({ text: ">" });
|
|
164805
|
+
}
|
|
164806
|
+
break;
|
|
164807
|
+
case 171 /* PropertySignature */:
|
|
164808
|
+
const propertySignature = node;
|
|
164809
|
+
if (propertySignature.modifiers) {
|
|
164810
|
+
visitDisplayPartList(propertySignature.modifiers, " ");
|
|
164811
|
+
}
|
|
164812
|
+
visitForDisplayParts(propertySignature.name);
|
|
164813
|
+
if (propertySignature.questionToken) {
|
|
164814
|
+
parts.push({ text: "?" });
|
|
164815
|
+
}
|
|
164816
|
+
if (propertySignature.type) {
|
|
164817
|
+
parts.push({ text: ": " });
|
|
164818
|
+
visitForDisplayParts(propertySignature.type);
|
|
164819
|
+
}
|
|
164820
|
+
break;
|
|
164821
|
+
default:
|
|
164822
|
+
Debug.failBadSyntaxKind(node);
|
|
164823
|
+
}
|
|
164824
|
+
}
|
|
164825
|
+
function visitDisplayPartList(nodes, separator) {
|
|
164826
|
+
nodes.forEach((node, index) => {
|
|
164827
|
+
if (index > 0) {
|
|
164828
|
+
parts.push({ text: separator });
|
|
164829
|
+
}
|
|
164830
|
+
visitForDisplayParts(node);
|
|
164831
|
+
});
|
|
164832
|
+
}
|
|
164833
|
+
}
|
|
164545
164834
|
function isUndefined(name) {
|
|
164546
164835
|
return name === "undefined";
|
|
164547
164836
|
}
|
|
@@ -164561,12 +164850,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164561
164850
|
};
|
|
164562
164851
|
}
|
|
164563
164852
|
}
|
|
164564
|
-
var
|
|
164853
|
+
var leadingParameterNameCommentRegexFactory;
|
|
164565
164854
|
var init_inlayHints = __esm({
|
|
164566
164855
|
"src/services/inlayHints.ts"() {
|
|
164567
164856
|
"use strict";
|
|
164568
164857
|
init_ts4();
|
|
164569
|
-
maxTypeHintLength = 30;
|
|
164570
164858
|
leadingParameterNameCommentRegexFactory = (name) => {
|
|
164571
164859
|
return new RegExp(`^\\s?/\\*\\*?\\s?${name}\\s?\\*\\/\\s?$`);
|
|
164572
164860
|
};
|
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.3.0-pr-
|
|
5
|
+
"version": "5.3.0-pr-52972-6",
|
|
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": "3be6be6c3b7f564f8a49926c47ce91e7db814b91"
|
|
118
118
|
}
|