typescript 5.6.0-dev.20240729 → 5.6.0-dev.20240731
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/cs/diagnosticMessages.generated.json +285 -85
- package/lib/de/diagnosticMessages.generated.json +285 -85
- package/lib/es/diagnosticMessages.generated.json +283 -83
- package/lib/fr/diagnosticMessages.generated.json +285 -85
- package/lib/it/diagnosticMessages.generated.json +284 -84
- package/lib/ja/diagnosticMessages.generated.json +284 -84
- package/lib/ko/diagnosticMessages.generated.json +284 -84
- package/lib/pl/diagnosticMessages.generated.json +283 -83
- package/lib/pt-br/diagnosticMessages.generated.json +285 -85
- package/lib/ru/diagnosticMessages.generated.json +285 -85
- package/lib/tr/diagnosticMessages.generated.json +285 -85
- package/lib/tsc.js +34 -13
- package/lib/typescript.js +240 -174
- package/lib/zh-cn/diagnosticMessages.generated.json +284 -84
- package/lib/zh-tw/diagnosticMessages.generated.json +281 -81
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -2260,7 +2260,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2260
2260
|
|
|
2261
2261
|
// src/compiler/corePublic.ts
|
|
2262
2262
|
var versionMajorMinor = "5.6";
|
|
2263
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2263
|
+
var version = `${versionMajorMinor}.0-dev.20240731`;
|
|
2264
2264
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2265
2265
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2266
2266
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -83424,7 +83424,17 @@ function createTypeChecker(host) {
|
|
|
83424
83424
|
if (!ok) {
|
|
83425
83425
|
error2(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
|
|
83426
83426
|
}
|
|
83427
|
-
if (
|
|
83427
|
+
if (compilerOptions.isolatedModules || compilerOptions.verbatimModuleSyntax && ok && !resolveName(
|
|
83428
|
+
node,
|
|
83429
|
+
getFirstIdentifier(node),
|
|
83430
|
+
2097152 /* Alias */,
|
|
83431
|
+
/*nameNotFoundMessage*/
|
|
83432
|
+
void 0,
|
|
83433
|
+
/*isUse*/
|
|
83434
|
+
false,
|
|
83435
|
+
/*excludeGlobals*/
|
|
83436
|
+
true
|
|
83437
|
+
)) {
|
|
83428
83438
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
83429
83439
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
83430
83440
|
const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
|
|
@@ -84385,16 +84395,20 @@ function createTypeChecker(host) {
|
|
|
84385
84395
|
const someButNotAllOverloadFlags = someOverloadFlags ^ allOverloadFlags;
|
|
84386
84396
|
if (someButNotAllOverloadFlags !== 0) {
|
|
84387
84397
|
const canonicalFlags = getEffectiveDeclarationFlags(getCanonicalOverload(overloads, implementation), flagsToCheck2);
|
|
84388
|
-
|
|
84389
|
-
const
|
|
84390
|
-
|
|
84391
|
-
|
|
84392
|
-
|
|
84393
|
-
|
|
84394
|
-
|
|
84395
|
-
|
|
84396
|
-
|
|
84397
|
-
|
|
84398
|
+
group(overloads, (o) => getSourceFileOfNode(o).fileName).forEach((overloadsInFile) => {
|
|
84399
|
+
const canonicalFlagsForFile = getEffectiveDeclarationFlags(getCanonicalOverload(overloadsInFile, implementation), flagsToCheck2);
|
|
84400
|
+
for (const o of overloadsInFile) {
|
|
84401
|
+
const deviation = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlags;
|
|
84402
|
+
const deviationInFile = getEffectiveDeclarationFlags(o, flagsToCheck2) ^ canonicalFlagsForFile;
|
|
84403
|
+
if (deviationInFile & 32 /* Export */) {
|
|
84404
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_exported_or_non_exported);
|
|
84405
|
+
} else if (deviationInFile & 128 /* Ambient */) {
|
|
84406
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_ambient_or_non_ambient);
|
|
84407
|
+
} else if (deviation & (2 /* Private */ | 4 /* Protected */)) {
|
|
84408
|
+
error2(getNameOfDeclaration(o) || o, Diagnostics.Overload_signatures_must_all_be_public_private_or_protected);
|
|
84409
|
+
} else if (deviation & 64 /* Abstract */) {
|
|
84410
|
+
error2(getNameOfDeclaration(o), Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract);
|
|
84411
|
+
}
|
|
84398
84412
|
}
|
|
84399
84413
|
});
|
|
84400
84414
|
}
|
|
@@ -85529,7 +85543,7 @@ function createTypeChecker(host) {
|
|
|
85529
85543
|
if (!wrappingDeclaration.type) {
|
|
85530
85544
|
addRelatedInfo(
|
|
85531
85545
|
diagnostic,
|
|
85532
|
-
createFileDiagnostic(getSourceFileOfNode(wrappingDeclaration), wrappingDeclaration.end,
|
|
85546
|
+
createFileDiagnostic(getSourceFileOfNode(wrappingDeclaration), wrappingDeclaration.end, 0, Diagnostics.We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here, declarationNameToString(node.propertyName))
|
|
85533
85547
|
);
|
|
85534
85548
|
}
|
|
85535
85549
|
diagnostics.add(diagnostic);
|
|
@@ -88372,6 +88386,13 @@ function createTypeChecker(host) {
|
|
|
88372
88386
|
} else if (moduleKind === 200 /* Preserve */ && node.kind !== 271 /* ImportEqualsDeclaration */ && node.kind !== 260 /* VariableDeclaration */ && host.getEmitModuleFormatOfFile(getSourceFileOfNode(node)) === 1 /* CommonJS */) {
|
|
88373
88387
|
error2(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve);
|
|
88374
88388
|
}
|
|
88389
|
+
if (compilerOptions.verbatimModuleSyntax && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 33554432 /* Ambient */) && targetFlags & 128 /* ConstEnum */) {
|
|
88390
|
+
const constEnumDeclaration = target.valueDeclaration;
|
|
88391
|
+
const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(getSourceFileOfNode(constEnumDeclaration).resolvedPath);
|
|
88392
|
+
if (constEnumDeclaration.flags & 33554432 /* Ambient */ && (!redirect || !shouldPreserveConstEnums(redirect.commandLine.options))) {
|
|
88393
|
+
error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
88394
|
+
}
|
|
88395
|
+
}
|
|
88375
88396
|
}
|
|
88376
88397
|
if (isImportSpecifier(node)) {
|
|
88377
88398
|
const targetSymbol = resolveAliasWithDeprecationCheck(symbol, node);
|
|
@@ -171192,6 +171213,14 @@ function provideInlayHints(context) {
|
|
|
171192
171213
|
if (!signature) {
|
|
171193
171214
|
return;
|
|
171194
171215
|
}
|
|
171216
|
+
const typePredicate = checker.getTypePredicateOfSignature(signature);
|
|
171217
|
+
if (typePredicate == null ? void 0 : typePredicate.type) {
|
|
171218
|
+
const hintParts2 = typePredicateToInlayHintParts(typePredicate);
|
|
171219
|
+
if (hintParts2) {
|
|
171220
|
+
addTypeHints(hintParts2, getTypeAnnotationPosition(decl));
|
|
171221
|
+
return;
|
|
171222
|
+
}
|
|
171223
|
+
}
|
|
171195
171224
|
const returnType = checker.getReturnTypeOfSignature(signature);
|
|
171196
171225
|
if (isModuleReferenceType(returnType)) {
|
|
171197
171226
|
return;
|
|
@@ -171260,6 +171289,26 @@ function provideInlayHints(context) {
|
|
|
171260
171289
|
);
|
|
171261
171290
|
});
|
|
171262
171291
|
}
|
|
171292
|
+
function printTypePredicateInSingleLine(typePredicate) {
|
|
171293
|
+
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
171294
|
+
const printer = createPrinterWithRemoveComments();
|
|
171295
|
+
return usingSingleLineStringWriter((writer) => {
|
|
171296
|
+
const typePredicateNode = checker.typePredicateToTypePredicateNode(
|
|
171297
|
+
typePredicate,
|
|
171298
|
+
/*enclosingDeclaration*/
|
|
171299
|
+
void 0,
|
|
171300
|
+
flags
|
|
171301
|
+
);
|
|
171302
|
+
Debug.assertIsDefined(typePredicateNode, "should always get typePredicateNode");
|
|
171303
|
+
printer.writeNode(
|
|
171304
|
+
4 /* Unspecified */,
|
|
171305
|
+
typePredicateNode,
|
|
171306
|
+
/*sourceFile*/
|
|
171307
|
+
file,
|
|
171308
|
+
writer
|
|
171309
|
+
);
|
|
171310
|
+
});
|
|
171311
|
+
}
|
|
171263
171312
|
function typeToInlayHintParts(type) {
|
|
171264
171313
|
if (!shouldUseInteractiveInlayHints(preferences)) {
|
|
171265
171314
|
return printTypeInSingleLine(type);
|
|
@@ -171271,29 +171320,46 @@ function provideInlayHints(context) {
|
|
|
171271
171320
|
void 0,
|
|
171272
171321
|
flags
|
|
171273
171322
|
);
|
|
171323
|
+
Debug.assertIsDefined(typeNode, "should always get typeNode");
|
|
171324
|
+
return getInlayHintDisplayParts(typeNode);
|
|
171325
|
+
}
|
|
171326
|
+
function typePredicateToInlayHintParts(typePredicate) {
|
|
171327
|
+
if (!shouldUseInteractiveInlayHints(preferences)) {
|
|
171328
|
+
return printTypePredicateInSingleLine(typePredicate);
|
|
171329
|
+
}
|
|
171330
|
+
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
171331
|
+
const typeNode = checker.typePredicateToTypePredicateNode(
|
|
171332
|
+
typePredicate,
|
|
171333
|
+
/*enclosingDeclaration*/
|
|
171334
|
+
void 0,
|
|
171335
|
+
flags
|
|
171336
|
+
);
|
|
171274
171337
|
Debug.assertIsDefined(typeNode, "should always get typenode");
|
|
171338
|
+
return getInlayHintDisplayParts(typeNode);
|
|
171339
|
+
}
|
|
171340
|
+
function getInlayHintDisplayParts(node) {
|
|
171275
171341
|
const parts = [];
|
|
171276
|
-
visitForDisplayParts(
|
|
171342
|
+
visitForDisplayParts(node);
|
|
171277
171343
|
return parts;
|
|
171278
|
-
function visitForDisplayParts(
|
|
171344
|
+
function visitForDisplayParts(node2) {
|
|
171279
171345
|
var _a, _b;
|
|
171280
|
-
if (!
|
|
171346
|
+
if (!node2) {
|
|
171281
171347
|
return;
|
|
171282
171348
|
}
|
|
171283
|
-
const tokenString = tokenToString(
|
|
171349
|
+
const tokenString = tokenToString(node2.kind);
|
|
171284
171350
|
if (tokenString) {
|
|
171285
171351
|
parts.push({ text: tokenString });
|
|
171286
171352
|
return;
|
|
171287
171353
|
}
|
|
171288
|
-
if (isLiteralExpression(
|
|
171289
|
-
parts.push({ text: getLiteralText2(
|
|
171354
|
+
if (isLiteralExpression(node2)) {
|
|
171355
|
+
parts.push({ text: getLiteralText2(node2) });
|
|
171290
171356
|
return;
|
|
171291
171357
|
}
|
|
171292
|
-
switch (
|
|
171358
|
+
switch (node2.kind) {
|
|
171293
171359
|
case 80 /* Identifier */:
|
|
171294
|
-
Debug.assertNode(
|
|
171295
|
-
const identifierText = idText(
|
|
171296
|
-
const name =
|
|
171360
|
+
Debug.assertNode(node2, isIdentifier);
|
|
171361
|
+
const identifierText = idText(node2);
|
|
171362
|
+
const name = node2.symbol && node2.symbol.declarations && node2.symbol.declarations.length && getNameOfDeclaration(node2.symbol.declarations[0]);
|
|
171297
171363
|
if (name) {
|
|
171298
171364
|
parts.push(getNodeDisplayPart(identifierText, name));
|
|
171299
171365
|
} else {
|
|
@@ -171301,331 +171367,331 @@ function provideInlayHints(context) {
|
|
|
171301
171367
|
}
|
|
171302
171368
|
break;
|
|
171303
171369
|
case 166 /* QualifiedName */:
|
|
171304
|
-
Debug.assertNode(
|
|
171305
|
-
visitForDisplayParts(
|
|
171370
|
+
Debug.assertNode(node2, isQualifiedName);
|
|
171371
|
+
visitForDisplayParts(node2.left);
|
|
171306
171372
|
parts.push({ text: "." });
|
|
171307
|
-
visitForDisplayParts(
|
|
171373
|
+
visitForDisplayParts(node2.right);
|
|
171308
171374
|
break;
|
|
171309
171375
|
case 182 /* TypePredicate */:
|
|
171310
|
-
Debug.assertNode(
|
|
171311
|
-
if (
|
|
171376
|
+
Debug.assertNode(node2, isTypePredicateNode);
|
|
171377
|
+
if (node2.assertsModifier) {
|
|
171312
171378
|
parts.push({ text: "asserts " });
|
|
171313
171379
|
}
|
|
171314
|
-
visitForDisplayParts(
|
|
171315
|
-
if (
|
|
171380
|
+
visitForDisplayParts(node2.parameterName);
|
|
171381
|
+
if (node2.type) {
|
|
171316
171382
|
parts.push({ text: " is " });
|
|
171317
|
-
visitForDisplayParts(
|
|
171383
|
+
visitForDisplayParts(node2.type);
|
|
171318
171384
|
}
|
|
171319
171385
|
break;
|
|
171320
171386
|
case 183 /* TypeReference */:
|
|
171321
|
-
Debug.assertNode(
|
|
171322
|
-
visitForDisplayParts(
|
|
171323
|
-
if (
|
|
171387
|
+
Debug.assertNode(node2, isTypeReferenceNode);
|
|
171388
|
+
visitForDisplayParts(node2.typeName);
|
|
171389
|
+
if (node2.typeArguments) {
|
|
171324
171390
|
parts.push({ text: "<" });
|
|
171325
|
-
visitDisplayPartList(
|
|
171391
|
+
visitDisplayPartList(node2.typeArguments, ", ");
|
|
171326
171392
|
parts.push({ text: ">" });
|
|
171327
171393
|
}
|
|
171328
171394
|
break;
|
|
171329
171395
|
case 168 /* TypeParameter */:
|
|
171330
|
-
Debug.assertNode(
|
|
171331
|
-
if (
|
|
171332
|
-
visitDisplayPartList(
|
|
171396
|
+
Debug.assertNode(node2, isTypeParameterDeclaration);
|
|
171397
|
+
if (node2.modifiers) {
|
|
171398
|
+
visitDisplayPartList(node2.modifiers, " ");
|
|
171333
171399
|
}
|
|
171334
|
-
visitForDisplayParts(
|
|
171335
|
-
if (
|
|
171400
|
+
visitForDisplayParts(node2.name);
|
|
171401
|
+
if (node2.constraint) {
|
|
171336
171402
|
parts.push({ text: " extends " });
|
|
171337
|
-
visitForDisplayParts(
|
|
171403
|
+
visitForDisplayParts(node2.constraint);
|
|
171338
171404
|
}
|
|
171339
|
-
if (
|
|
171405
|
+
if (node2.default) {
|
|
171340
171406
|
parts.push({ text: " = " });
|
|
171341
|
-
visitForDisplayParts(
|
|
171407
|
+
visitForDisplayParts(node2.default);
|
|
171342
171408
|
}
|
|
171343
171409
|
break;
|
|
171344
171410
|
case 169 /* Parameter */:
|
|
171345
|
-
Debug.assertNode(
|
|
171346
|
-
if (
|
|
171347
|
-
visitDisplayPartList(
|
|
171411
|
+
Debug.assertNode(node2, isParameter);
|
|
171412
|
+
if (node2.modifiers) {
|
|
171413
|
+
visitDisplayPartList(node2.modifiers, " ");
|
|
171348
171414
|
}
|
|
171349
|
-
if (
|
|
171415
|
+
if (node2.dotDotDotToken) {
|
|
171350
171416
|
parts.push({ text: "..." });
|
|
171351
171417
|
}
|
|
171352
|
-
visitForDisplayParts(
|
|
171353
|
-
if (
|
|
171418
|
+
visitForDisplayParts(node2.name);
|
|
171419
|
+
if (node2.questionToken) {
|
|
171354
171420
|
parts.push({ text: "?" });
|
|
171355
171421
|
}
|
|
171356
|
-
if (
|
|
171422
|
+
if (node2.type) {
|
|
171357
171423
|
parts.push({ text: ": " });
|
|
171358
|
-
visitForDisplayParts(
|
|
171424
|
+
visitForDisplayParts(node2.type);
|
|
171359
171425
|
}
|
|
171360
171426
|
break;
|
|
171361
171427
|
case 185 /* ConstructorType */:
|
|
171362
|
-
Debug.assertNode(
|
|
171428
|
+
Debug.assertNode(node2, isConstructorTypeNode);
|
|
171363
171429
|
parts.push({ text: "new " });
|
|
171364
|
-
visitParametersAndTypeParameters(
|
|
171430
|
+
visitParametersAndTypeParameters(node2);
|
|
171365
171431
|
parts.push({ text: " => " });
|
|
171366
|
-
visitForDisplayParts(
|
|
171432
|
+
visitForDisplayParts(node2.type);
|
|
171367
171433
|
break;
|
|
171368
171434
|
case 186 /* TypeQuery */:
|
|
171369
|
-
Debug.assertNode(
|
|
171435
|
+
Debug.assertNode(node2, isTypeQueryNode);
|
|
171370
171436
|
parts.push({ text: "typeof " });
|
|
171371
|
-
visitForDisplayParts(
|
|
171372
|
-
if (
|
|
171437
|
+
visitForDisplayParts(node2.exprName);
|
|
171438
|
+
if (node2.typeArguments) {
|
|
171373
171439
|
parts.push({ text: "<" });
|
|
171374
|
-
visitDisplayPartList(
|
|
171440
|
+
visitDisplayPartList(node2.typeArguments, ", ");
|
|
171375
171441
|
parts.push({ text: ">" });
|
|
171376
171442
|
}
|
|
171377
171443
|
break;
|
|
171378
171444
|
case 187 /* TypeLiteral */:
|
|
171379
|
-
Debug.assertNode(
|
|
171445
|
+
Debug.assertNode(node2, isTypeLiteralNode);
|
|
171380
171446
|
parts.push({ text: "{" });
|
|
171381
|
-
if (
|
|
171447
|
+
if (node2.members.length) {
|
|
171382
171448
|
parts.push({ text: " " });
|
|
171383
|
-
visitDisplayPartList(
|
|
171449
|
+
visitDisplayPartList(node2.members, "; ");
|
|
171384
171450
|
parts.push({ text: " " });
|
|
171385
171451
|
}
|
|
171386
171452
|
parts.push({ text: "}" });
|
|
171387
171453
|
break;
|
|
171388
171454
|
case 188 /* ArrayType */:
|
|
171389
|
-
Debug.assertNode(
|
|
171390
|
-
visitForDisplayParts(
|
|
171455
|
+
Debug.assertNode(node2, isArrayTypeNode);
|
|
171456
|
+
visitForDisplayParts(node2.elementType);
|
|
171391
171457
|
parts.push({ text: "[]" });
|
|
171392
171458
|
break;
|
|
171393
171459
|
case 189 /* TupleType */:
|
|
171394
|
-
Debug.assertNode(
|
|
171460
|
+
Debug.assertNode(node2, isTupleTypeNode);
|
|
171395
171461
|
parts.push({ text: "[" });
|
|
171396
|
-
visitDisplayPartList(
|
|
171462
|
+
visitDisplayPartList(node2.elements, ", ");
|
|
171397
171463
|
parts.push({ text: "]" });
|
|
171398
171464
|
break;
|
|
171399
171465
|
case 202 /* NamedTupleMember */:
|
|
171400
|
-
Debug.assertNode(
|
|
171401
|
-
if (
|
|
171466
|
+
Debug.assertNode(node2, isNamedTupleMember);
|
|
171467
|
+
if (node2.dotDotDotToken) {
|
|
171402
171468
|
parts.push({ text: "..." });
|
|
171403
171469
|
}
|
|
171404
|
-
visitForDisplayParts(
|
|
171405
|
-
if (
|
|
171470
|
+
visitForDisplayParts(node2.name);
|
|
171471
|
+
if (node2.questionToken) {
|
|
171406
171472
|
parts.push({ text: "?" });
|
|
171407
171473
|
}
|
|
171408
171474
|
parts.push({ text: ": " });
|
|
171409
|
-
visitForDisplayParts(
|
|
171475
|
+
visitForDisplayParts(node2.type);
|
|
171410
171476
|
break;
|
|
171411
171477
|
case 190 /* OptionalType */:
|
|
171412
|
-
Debug.assertNode(
|
|
171413
|
-
visitForDisplayParts(
|
|
171478
|
+
Debug.assertNode(node2, isOptionalTypeNode);
|
|
171479
|
+
visitForDisplayParts(node2.type);
|
|
171414
171480
|
parts.push({ text: "?" });
|
|
171415
171481
|
break;
|
|
171416
171482
|
case 191 /* RestType */:
|
|
171417
|
-
Debug.assertNode(
|
|
171483
|
+
Debug.assertNode(node2, isRestTypeNode);
|
|
171418
171484
|
parts.push({ text: "..." });
|
|
171419
|
-
visitForDisplayParts(
|
|
171485
|
+
visitForDisplayParts(node2.type);
|
|
171420
171486
|
break;
|
|
171421
171487
|
case 192 /* UnionType */:
|
|
171422
|
-
Debug.assertNode(
|
|
171423
|
-
visitDisplayPartList(
|
|
171488
|
+
Debug.assertNode(node2, isUnionTypeNode);
|
|
171489
|
+
visitDisplayPartList(node2.types, " | ");
|
|
171424
171490
|
break;
|
|
171425
171491
|
case 193 /* IntersectionType */:
|
|
171426
|
-
Debug.assertNode(
|
|
171427
|
-
visitDisplayPartList(
|
|
171492
|
+
Debug.assertNode(node2, isIntersectionTypeNode);
|
|
171493
|
+
visitDisplayPartList(node2.types, " & ");
|
|
171428
171494
|
break;
|
|
171429
171495
|
case 194 /* ConditionalType */:
|
|
171430
|
-
Debug.assertNode(
|
|
171431
|
-
visitForDisplayParts(
|
|
171496
|
+
Debug.assertNode(node2, isConditionalTypeNode);
|
|
171497
|
+
visitForDisplayParts(node2.checkType);
|
|
171432
171498
|
parts.push({ text: " extends " });
|
|
171433
|
-
visitForDisplayParts(
|
|
171499
|
+
visitForDisplayParts(node2.extendsType);
|
|
171434
171500
|
parts.push({ text: " ? " });
|
|
171435
|
-
visitForDisplayParts(
|
|
171501
|
+
visitForDisplayParts(node2.trueType);
|
|
171436
171502
|
parts.push({ text: " : " });
|
|
171437
|
-
visitForDisplayParts(
|
|
171503
|
+
visitForDisplayParts(node2.falseType);
|
|
171438
171504
|
break;
|
|
171439
171505
|
case 195 /* InferType */:
|
|
171440
|
-
Debug.assertNode(
|
|
171506
|
+
Debug.assertNode(node2, isInferTypeNode);
|
|
171441
171507
|
parts.push({ text: "infer " });
|
|
171442
|
-
visitForDisplayParts(
|
|
171508
|
+
visitForDisplayParts(node2.typeParameter);
|
|
171443
171509
|
break;
|
|
171444
171510
|
case 196 /* ParenthesizedType */:
|
|
171445
|
-
Debug.assertNode(
|
|
171511
|
+
Debug.assertNode(node2, isParenthesizedTypeNode);
|
|
171446
171512
|
parts.push({ text: "(" });
|
|
171447
|
-
visitForDisplayParts(
|
|
171513
|
+
visitForDisplayParts(node2.type);
|
|
171448
171514
|
parts.push({ text: ")" });
|
|
171449
171515
|
break;
|
|
171450
171516
|
case 198 /* TypeOperator */:
|
|
171451
|
-
Debug.assertNode(
|
|
171452
|
-
parts.push({ text: `${tokenToString(
|
|
171453
|
-
visitForDisplayParts(
|
|
171517
|
+
Debug.assertNode(node2, isTypeOperatorNode);
|
|
171518
|
+
parts.push({ text: `${tokenToString(node2.operator)} ` });
|
|
171519
|
+
visitForDisplayParts(node2.type);
|
|
171454
171520
|
break;
|
|
171455
171521
|
case 199 /* IndexedAccessType */:
|
|
171456
|
-
Debug.assertNode(
|
|
171457
|
-
visitForDisplayParts(
|
|
171522
|
+
Debug.assertNode(node2, isIndexedAccessTypeNode);
|
|
171523
|
+
visitForDisplayParts(node2.objectType);
|
|
171458
171524
|
parts.push({ text: "[" });
|
|
171459
|
-
visitForDisplayParts(
|
|
171525
|
+
visitForDisplayParts(node2.indexType);
|
|
171460
171526
|
parts.push({ text: "]" });
|
|
171461
171527
|
break;
|
|
171462
171528
|
case 200 /* MappedType */:
|
|
171463
|
-
Debug.assertNode(
|
|
171529
|
+
Debug.assertNode(node2, isMappedTypeNode);
|
|
171464
171530
|
parts.push({ text: "{ " });
|
|
171465
|
-
if (
|
|
171466
|
-
if (
|
|
171531
|
+
if (node2.readonlyToken) {
|
|
171532
|
+
if (node2.readonlyToken.kind === 40 /* PlusToken */) {
|
|
171467
171533
|
parts.push({ text: "+" });
|
|
171468
|
-
} else if (
|
|
171534
|
+
} else if (node2.readonlyToken.kind === 41 /* MinusToken */) {
|
|
171469
171535
|
parts.push({ text: "-" });
|
|
171470
171536
|
}
|
|
171471
171537
|
parts.push({ text: "readonly " });
|
|
171472
171538
|
}
|
|
171473
171539
|
parts.push({ text: "[" });
|
|
171474
|
-
visitForDisplayParts(
|
|
171475
|
-
if (
|
|
171540
|
+
visitForDisplayParts(node2.typeParameter);
|
|
171541
|
+
if (node2.nameType) {
|
|
171476
171542
|
parts.push({ text: " as " });
|
|
171477
|
-
visitForDisplayParts(
|
|
171543
|
+
visitForDisplayParts(node2.nameType);
|
|
171478
171544
|
}
|
|
171479
171545
|
parts.push({ text: "]" });
|
|
171480
|
-
if (
|
|
171481
|
-
if (
|
|
171546
|
+
if (node2.questionToken) {
|
|
171547
|
+
if (node2.questionToken.kind === 40 /* PlusToken */) {
|
|
171482
171548
|
parts.push({ text: "+" });
|
|
171483
|
-
} else if (
|
|
171549
|
+
} else if (node2.questionToken.kind === 41 /* MinusToken */) {
|
|
171484
171550
|
parts.push({ text: "-" });
|
|
171485
171551
|
}
|
|
171486
171552
|
parts.push({ text: "?" });
|
|
171487
171553
|
}
|
|
171488
171554
|
parts.push({ text: ": " });
|
|
171489
|
-
if (
|
|
171490
|
-
visitForDisplayParts(
|
|
171555
|
+
if (node2.type) {
|
|
171556
|
+
visitForDisplayParts(node2.type);
|
|
171491
171557
|
}
|
|
171492
171558
|
parts.push({ text: "; }" });
|
|
171493
171559
|
break;
|
|
171494
171560
|
case 201 /* LiteralType */:
|
|
171495
|
-
Debug.assertNode(
|
|
171496
|
-
visitForDisplayParts(
|
|
171561
|
+
Debug.assertNode(node2, isLiteralTypeNode);
|
|
171562
|
+
visitForDisplayParts(node2.literal);
|
|
171497
171563
|
break;
|
|
171498
171564
|
case 184 /* FunctionType */:
|
|
171499
|
-
Debug.assertNode(
|
|
171500
|
-
visitParametersAndTypeParameters(
|
|
171565
|
+
Debug.assertNode(node2, isFunctionTypeNode);
|
|
171566
|
+
visitParametersAndTypeParameters(node2);
|
|
171501
171567
|
parts.push({ text: " => " });
|
|
171502
|
-
visitForDisplayParts(
|
|
171568
|
+
visitForDisplayParts(node2.type);
|
|
171503
171569
|
break;
|
|
171504
171570
|
case 205 /* ImportType */:
|
|
171505
|
-
Debug.assertNode(
|
|
171506
|
-
if (
|
|
171571
|
+
Debug.assertNode(node2, isImportTypeNode);
|
|
171572
|
+
if (node2.isTypeOf) {
|
|
171507
171573
|
parts.push({ text: "typeof " });
|
|
171508
171574
|
}
|
|
171509
171575
|
parts.push({ text: "import(" });
|
|
171510
|
-
visitForDisplayParts(
|
|
171511
|
-
if (
|
|
171576
|
+
visitForDisplayParts(node2.argument);
|
|
171577
|
+
if (node2.assertions) {
|
|
171512
171578
|
parts.push({ text: ", { assert: " });
|
|
171513
|
-
visitDisplayPartList(
|
|
171579
|
+
visitDisplayPartList(node2.assertions.assertClause.elements, ", ");
|
|
171514
171580
|
parts.push({ text: " }" });
|
|
171515
171581
|
}
|
|
171516
171582
|
parts.push({ text: ")" });
|
|
171517
|
-
if (
|
|
171583
|
+
if (node2.qualifier) {
|
|
171518
171584
|
parts.push({ text: "." });
|
|
171519
|
-
visitForDisplayParts(
|
|
171585
|
+
visitForDisplayParts(node2.qualifier);
|
|
171520
171586
|
}
|
|
171521
|
-
if (
|
|
171587
|
+
if (node2.typeArguments) {
|
|
171522
171588
|
parts.push({ text: "<" });
|
|
171523
|
-
visitDisplayPartList(
|
|
171589
|
+
visitDisplayPartList(node2.typeArguments, ", ");
|
|
171524
171590
|
parts.push({ text: ">" });
|
|
171525
171591
|
}
|
|
171526
171592
|
break;
|
|
171527
171593
|
case 171 /* PropertySignature */:
|
|
171528
|
-
Debug.assertNode(
|
|
171529
|
-
if ((_a =
|
|
171530
|
-
visitDisplayPartList(
|
|
171594
|
+
Debug.assertNode(node2, isPropertySignature);
|
|
171595
|
+
if ((_a = node2.modifiers) == null ? void 0 : _a.length) {
|
|
171596
|
+
visitDisplayPartList(node2.modifiers, " ");
|
|
171531
171597
|
parts.push({ text: " " });
|
|
171532
171598
|
}
|
|
171533
|
-
visitForDisplayParts(
|
|
171534
|
-
if (
|
|
171599
|
+
visitForDisplayParts(node2.name);
|
|
171600
|
+
if (node2.questionToken) {
|
|
171535
171601
|
parts.push({ text: "?" });
|
|
171536
171602
|
}
|
|
171537
|
-
if (
|
|
171603
|
+
if (node2.type) {
|
|
171538
171604
|
parts.push({ text: ": " });
|
|
171539
|
-
visitForDisplayParts(
|
|
171605
|
+
visitForDisplayParts(node2.type);
|
|
171540
171606
|
}
|
|
171541
171607
|
break;
|
|
171542
171608
|
case 181 /* IndexSignature */:
|
|
171543
|
-
Debug.assertNode(
|
|
171609
|
+
Debug.assertNode(node2, isIndexSignatureDeclaration);
|
|
171544
171610
|
parts.push({ text: "[" });
|
|
171545
|
-
visitDisplayPartList(
|
|
171611
|
+
visitDisplayPartList(node2.parameters, ", ");
|
|
171546
171612
|
parts.push({ text: "]" });
|
|
171547
|
-
if (
|
|
171613
|
+
if (node2.type) {
|
|
171548
171614
|
parts.push({ text: ": " });
|
|
171549
|
-
visitForDisplayParts(
|
|
171615
|
+
visitForDisplayParts(node2.type);
|
|
171550
171616
|
}
|
|
171551
171617
|
break;
|
|
171552
171618
|
case 173 /* MethodSignature */:
|
|
171553
|
-
Debug.assertNode(
|
|
171554
|
-
if ((_b =
|
|
171555
|
-
visitDisplayPartList(
|
|
171619
|
+
Debug.assertNode(node2, isMethodSignature);
|
|
171620
|
+
if ((_b = node2.modifiers) == null ? void 0 : _b.length) {
|
|
171621
|
+
visitDisplayPartList(node2.modifiers, " ");
|
|
171556
171622
|
parts.push({ text: " " });
|
|
171557
171623
|
}
|
|
171558
|
-
visitForDisplayParts(
|
|
171559
|
-
if (
|
|
171624
|
+
visitForDisplayParts(node2.name);
|
|
171625
|
+
if (node2.questionToken) {
|
|
171560
171626
|
parts.push({ text: "?" });
|
|
171561
171627
|
}
|
|
171562
|
-
visitParametersAndTypeParameters(
|
|
171563
|
-
if (
|
|
171628
|
+
visitParametersAndTypeParameters(node2);
|
|
171629
|
+
if (node2.type) {
|
|
171564
171630
|
parts.push({ text: ": " });
|
|
171565
|
-
visitForDisplayParts(
|
|
171631
|
+
visitForDisplayParts(node2.type);
|
|
171566
171632
|
}
|
|
171567
171633
|
break;
|
|
171568
171634
|
case 179 /* CallSignature */:
|
|
171569
|
-
Debug.assertNode(
|
|
171570
|
-
visitParametersAndTypeParameters(
|
|
171571
|
-
if (
|
|
171635
|
+
Debug.assertNode(node2, isCallSignatureDeclaration);
|
|
171636
|
+
visitParametersAndTypeParameters(node2);
|
|
171637
|
+
if (node2.type) {
|
|
171572
171638
|
parts.push({ text: ": " });
|
|
171573
|
-
visitForDisplayParts(
|
|
171639
|
+
visitForDisplayParts(node2.type);
|
|
171574
171640
|
}
|
|
171575
171641
|
break;
|
|
171576
171642
|
case 207 /* ArrayBindingPattern */:
|
|
171577
|
-
Debug.assertNode(
|
|
171643
|
+
Debug.assertNode(node2, isArrayBindingPattern);
|
|
171578
171644
|
parts.push({ text: "[" });
|
|
171579
|
-
visitDisplayPartList(
|
|
171645
|
+
visitDisplayPartList(node2.elements, ", ");
|
|
171580
171646
|
parts.push({ text: "]" });
|
|
171581
171647
|
break;
|
|
171582
171648
|
case 206 /* ObjectBindingPattern */:
|
|
171583
|
-
Debug.assertNode(
|
|
171649
|
+
Debug.assertNode(node2, isObjectBindingPattern);
|
|
171584
171650
|
parts.push({ text: "{" });
|
|
171585
|
-
if (
|
|
171651
|
+
if (node2.elements.length) {
|
|
171586
171652
|
parts.push({ text: " " });
|
|
171587
|
-
visitDisplayPartList(
|
|
171653
|
+
visitDisplayPartList(node2.elements, ", ");
|
|
171588
171654
|
parts.push({ text: " " });
|
|
171589
171655
|
}
|
|
171590
171656
|
parts.push({ text: "}" });
|
|
171591
171657
|
break;
|
|
171592
171658
|
case 208 /* BindingElement */:
|
|
171593
|
-
Debug.assertNode(
|
|
171594
|
-
visitForDisplayParts(
|
|
171659
|
+
Debug.assertNode(node2, isBindingElement);
|
|
171660
|
+
visitForDisplayParts(node2.name);
|
|
171595
171661
|
break;
|
|
171596
171662
|
case 224 /* PrefixUnaryExpression */:
|
|
171597
|
-
Debug.assertNode(
|
|
171598
|
-
parts.push({ text: tokenToString(
|
|
171599
|
-
visitForDisplayParts(
|
|
171663
|
+
Debug.assertNode(node2, isPrefixUnaryExpression);
|
|
171664
|
+
parts.push({ text: tokenToString(node2.operator) });
|
|
171665
|
+
visitForDisplayParts(node2.operand);
|
|
171600
171666
|
break;
|
|
171601
171667
|
case 203 /* TemplateLiteralType */:
|
|
171602
|
-
Debug.assertNode(
|
|
171603
|
-
visitForDisplayParts(
|
|
171604
|
-
|
|
171668
|
+
Debug.assertNode(node2, isTemplateLiteralTypeNode);
|
|
171669
|
+
visitForDisplayParts(node2.head);
|
|
171670
|
+
node2.templateSpans.forEach(visitForDisplayParts);
|
|
171605
171671
|
break;
|
|
171606
171672
|
case 16 /* TemplateHead */:
|
|
171607
|
-
Debug.assertNode(
|
|
171608
|
-
parts.push({ text: getLiteralText2(
|
|
171673
|
+
Debug.assertNode(node2, isTemplateHead);
|
|
171674
|
+
parts.push({ text: getLiteralText2(node2) });
|
|
171609
171675
|
break;
|
|
171610
171676
|
case 204 /* TemplateLiteralTypeSpan */:
|
|
171611
|
-
Debug.assertNode(
|
|
171612
|
-
visitForDisplayParts(
|
|
171613
|
-
visitForDisplayParts(
|
|
171677
|
+
Debug.assertNode(node2, isTemplateLiteralTypeSpan);
|
|
171678
|
+
visitForDisplayParts(node2.type);
|
|
171679
|
+
visitForDisplayParts(node2.literal);
|
|
171614
171680
|
break;
|
|
171615
171681
|
case 17 /* TemplateMiddle */:
|
|
171616
|
-
Debug.assertNode(
|
|
171617
|
-
parts.push({ text: getLiteralText2(
|
|
171682
|
+
Debug.assertNode(node2, isTemplateMiddle);
|
|
171683
|
+
parts.push({ text: getLiteralText2(node2) });
|
|
171618
171684
|
break;
|
|
171619
171685
|
case 18 /* TemplateTail */:
|
|
171620
|
-
Debug.assertNode(
|
|
171621
|
-
parts.push({ text: getLiteralText2(
|
|
171686
|
+
Debug.assertNode(node2, isTemplateTail);
|
|
171687
|
+
parts.push({ text: getLiteralText2(node2) });
|
|
171622
171688
|
break;
|
|
171623
171689
|
case 197 /* ThisType */:
|
|
171624
|
-
Debug.assertNode(
|
|
171690
|
+
Debug.assertNode(node2, isThisTypeNode);
|
|
171625
171691
|
parts.push({ text: "this" });
|
|
171626
171692
|
break;
|
|
171627
171693
|
default:
|
|
171628
|
-
Debug.failBadSyntaxKind(
|
|
171694
|
+
Debug.failBadSyntaxKind(node2);
|
|
171629
171695
|
}
|
|
171630
171696
|
}
|
|
171631
171697
|
function visitParametersAndTypeParameters(signatureDeclaration) {
|
|
@@ -171639,22 +171705,22 @@ function provideInlayHints(context) {
|
|
|
171639
171705
|
parts.push({ text: ")" });
|
|
171640
171706
|
}
|
|
171641
171707
|
function visitDisplayPartList(nodes, separator) {
|
|
171642
|
-
nodes.forEach((
|
|
171708
|
+
nodes.forEach((node2, index) => {
|
|
171643
171709
|
if (index > 0) {
|
|
171644
171710
|
parts.push({ text: separator });
|
|
171645
171711
|
}
|
|
171646
|
-
visitForDisplayParts(
|
|
171712
|
+
visitForDisplayParts(node2);
|
|
171647
171713
|
});
|
|
171648
171714
|
}
|
|
171649
|
-
function getLiteralText2(
|
|
171650
|
-
switch (
|
|
171715
|
+
function getLiteralText2(node2) {
|
|
171716
|
+
switch (node2.kind) {
|
|
171651
171717
|
case 11 /* StringLiteral */:
|
|
171652
|
-
return quotePreference === 0 /* Single */ ? `'${escapeString(
|
|
171718
|
+
return quotePreference === 0 /* Single */ ? `'${escapeString(node2.text, 39 /* singleQuote */)}'` : `"${escapeString(node2.text, 34 /* doubleQuote */)}"`;
|
|
171653
171719
|
case 16 /* TemplateHead */:
|
|
171654
171720
|
case 17 /* TemplateMiddle */:
|
|
171655
171721
|
case 18 /* TemplateTail */: {
|
|
171656
|
-
const rawText =
|
|
171657
|
-
switch (
|
|
171722
|
+
const rawText = node2.rawText ?? escapeTemplateSubstitution(escapeString(node2.text, 96 /* backtick */));
|
|
171723
|
+
switch (node2.kind) {
|
|
171658
171724
|
case 16 /* TemplateHead */:
|
|
171659
171725
|
return "`" + rawText + "${";
|
|
171660
171726
|
case 17 /* TemplateMiddle */:
|
|
@@ -171664,7 +171730,7 @@ function provideInlayHints(context) {
|
|
|
171664
171730
|
}
|
|
171665
171731
|
}
|
|
171666
171732
|
}
|
|
171667
|
-
return
|
|
171733
|
+
return node2.text;
|
|
171668
171734
|
}
|
|
171669
171735
|
}
|
|
171670
171736
|
function isUndefined(name) {
|