typescript 5.2.0-dev.20230719 → 5.2.0-dev.20230721
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 +61 -46
- package/lib/tsserver.js +141 -75
- package/lib/tsserverlibrary.d.ts +13 -2
- package/lib/tsserverlibrary.js +140 -76
- package/lib/typescript.d.ts +7 -1
- package/lib/typescript.js +122 -72
- package/lib/typingsInstaller.js +10 -3
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230721`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -19225,6 +19225,18 @@ ${lanes.join("\n")}
|
|
|
19225
19225
|
function intrinsicTagNameToString(node) {
|
|
19226
19226
|
return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node);
|
|
19227
19227
|
}
|
|
19228
|
+
function isTypeUsableAsPropertyName(type) {
|
|
19229
|
+
return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
|
|
19230
|
+
}
|
|
19231
|
+
function getPropertyNameFromType(type) {
|
|
19232
|
+
if (type.flags & 8192 /* UniqueESSymbol */) {
|
|
19233
|
+
return type.escapedName;
|
|
19234
|
+
}
|
|
19235
|
+
if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
19236
|
+
return escapeLeadingUnderscores("" + type.value);
|
|
19237
|
+
}
|
|
19238
|
+
return Debug.fail();
|
|
19239
|
+
}
|
|
19228
19240
|
var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashLibReferenceRegEx, fullTripleSlashAMDReferencePathRegEx, fullTripleSlashAMDModuleRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, extensionsNotSupportingExtensionlessResolution, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
|
|
19229
19241
|
var init_utilities = __esm({
|
|
19230
19242
|
"src/compiler/utilities.ts"() {
|
|
@@ -33182,10 +33194,14 @@ ${lanes.join("\n")}
|
|
|
33182
33194
|
case 124 /* ProtectedKeyword */:
|
|
33183
33195
|
case 125 /* PublicKeyword */:
|
|
33184
33196
|
case 148 /* ReadonlyKeyword */:
|
|
33197
|
+
const previousToken = token();
|
|
33185
33198
|
nextToken();
|
|
33186
33199
|
if (scanner2.hasPrecedingLineBreak()) {
|
|
33187
33200
|
return false;
|
|
33188
33201
|
}
|
|
33202
|
+
if (previousToken === 138 /* DeclareKeyword */ && token() === 156 /* TypeKeyword */) {
|
|
33203
|
+
return true;
|
|
33204
|
+
}
|
|
33189
33205
|
continue;
|
|
33190
33206
|
case 162 /* GlobalKeyword */:
|
|
33191
33207
|
nextToken();
|
|
@@ -33550,14 +33566,14 @@ ${lanes.join("\n")}
|
|
|
33550
33566
|
function parseObjectBindingPattern() {
|
|
33551
33567
|
const pos = getNodePos();
|
|
33552
33568
|
parseExpected(19 /* OpenBraceToken */);
|
|
33553
|
-
const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
|
|
33569
|
+
const elements = allowInAnd(() => parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement));
|
|
33554
33570
|
parseExpected(20 /* CloseBraceToken */);
|
|
33555
33571
|
return finishNode(factory2.createObjectBindingPattern(elements), pos);
|
|
33556
33572
|
}
|
|
33557
33573
|
function parseArrayBindingPattern() {
|
|
33558
33574
|
const pos = getNodePos();
|
|
33559
33575
|
parseExpected(23 /* OpenBracketToken */);
|
|
33560
|
-
const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
|
|
33576
|
+
const elements = allowInAnd(() => parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement));
|
|
33561
33577
|
parseExpected(24 /* CloseBracketToken */);
|
|
33562
33578
|
return finishNode(factory2.createArrayBindingPattern(elements), pos);
|
|
33563
33579
|
}
|
|
@@ -34075,6 +34091,9 @@ ${lanes.join("\n")}
|
|
|
34075
34091
|
}
|
|
34076
34092
|
function parseTypeAliasDeclaration(pos, hasJSDoc, modifiers) {
|
|
34077
34093
|
parseExpected(156 /* TypeKeyword */);
|
|
34094
|
+
if (scanner2.hasPrecedingLineBreak()) {
|
|
34095
|
+
parseErrorAtCurrentToken(Diagnostics.Line_break_not_permitted_here);
|
|
34096
|
+
}
|
|
34078
34097
|
const name = parseIdentifier();
|
|
34079
34098
|
const typeParameters = parseTypeParameters();
|
|
34080
34099
|
parseExpected(64 /* EqualsToken */);
|
|
@@ -45585,7 +45604,7 @@ ${lanes.join("\n")}
|
|
|
45585
45604
|
return node ? getTypeFromTypeNode(node) : errorType;
|
|
45586
45605
|
},
|
|
45587
45606
|
getParameterType: getTypeAtPosition,
|
|
45588
|
-
|
|
45607
|
+
getParameterIdentifierInfoAtPosition,
|
|
45589
45608
|
getPromisedTypeOfPromise,
|
|
45590
45609
|
getAwaitedType: (type) => getAwaitedType(type),
|
|
45591
45610
|
getReturnTypeOfSignature,
|
|
@@ -47026,7 +47045,7 @@ ${lanes.join("\n")}
|
|
|
47026
47045
|
if (name === "const" && isConstAssertion(location)) {
|
|
47027
47046
|
return void 0;
|
|
47028
47047
|
}
|
|
47029
|
-
if (
|
|
47048
|
+
if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
|
|
47030
47049
|
lastLocation = location;
|
|
47031
47050
|
location = location.parent;
|
|
47032
47051
|
}
|
|
@@ -54048,7 +54067,7 @@ ${lanes.join("\n")}
|
|
|
54048
54067
|
false,
|
|
54049
54068
|
definedInMethod && !definedInConstructor
|
|
54050
54069
|
));
|
|
54051
|
-
if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
54070
|
+
if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
|
|
54052
54071
|
reportImplicitAny(symbol.valueDeclaration, anyType);
|
|
54053
54072
|
return anyType;
|
|
54054
54073
|
}
|
|
@@ -55327,9 +55346,6 @@ ${lanes.join("\n")}
|
|
|
55327
55346
|
}
|
|
55328
55347
|
return type;
|
|
55329
55348
|
}
|
|
55330
|
-
function isTypeUsableAsPropertyName(type) {
|
|
55331
|
-
return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
|
|
55332
|
-
}
|
|
55333
55349
|
function isLateBindableName(node) {
|
|
55334
55350
|
if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
|
|
55335
55351
|
return false;
|
|
@@ -55350,15 +55366,6 @@ ${lanes.join("\n")}
|
|
|
55350
55366
|
function isNonBindableDynamicName(node) {
|
|
55351
55367
|
return isDynamicName(node) && !isLateBindableName(node);
|
|
55352
55368
|
}
|
|
55353
|
-
function getPropertyNameFromType(type) {
|
|
55354
|
-
if (type.flags & 8192 /* UniqueESSymbol */) {
|
|
55355
|
-
return type.escapedName;
|
|
55356
|
-
}
|
|
55357
|
-
if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
|
|
55358
|
-
return escapeLeadingUnderscores("" + type.value);
|
|
55359
|
-
}
|
|
55360
|
-
return Debug.fail();
|
|
55361
|
-
}
|
|
55362
55369
|
function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
|
|
55363
55370
|
Debug.assert(!!(getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol.");
|
|
55364
55371
|
symbol.flags |= symbolFlags;
|
|
@@ -55408,6 +55415,7 @@ ${lanes.join("\n")}
|
|
|
55408
55415
|
return links.resolvedSymbol;
|
|
55409
55416
|
}
|
|
55410
55417
|
function getResolvedMembersOrExportsOfSymbol(symbol, resolutionKind) {
|
|
55418
|
+
var _a, _b, _c;
|
|
55411
55419
|
const links = getSymbolLinks(symbol);
|
|
55412
55420
|
if (!links[resolutionKind]) {
|
|
55413
55421
|
const isStatic2 = resolutionKind === "resolvedExports" /* resolvedExports */;
|
|
@@ -55426,7 +55434,7 @@ ${lanes.join("\n")}
|
|
|
55426
55434
|
}
|
|
55427
55435
|
}
|
|
55428
55436
|
}
|
|
55429
|
-
const assignments = symbol.assignmentDeclarationMembers;
|
|
55437
|
+
const assignments = (((_a = symbol.valueDeclaration) == null ? void 0 : _a.kind) === 219 /* ArrowFunction */ || ((_b = symbol.valueDeclaration) == null ? void 0 : _b.kind) === 218 /* FunctionExpression */) && ((_c = getSymbolOfNode(symbol.valueDeclaration.parent)) == null ? void 0 : _c.assignmentDeclarationMembers) || symbol.assignmentDeclarationMembers;
|
|
55430
55438
|
if (assignments) {
|
|
55431
55439
|
const decls = arrayFrom(assignments.values());
|
|
55432
55440
|
for (const member of decls) {
|
|
@@ -56004,20 +56012,17 @@ ${lanes.join("\n")}
|
|
|
56004
56012
|
setStructuredTypeMembers(type, members2, callSignatures, constructSignatures, indexInfos2);
|
|
56005
56013
|
return;
|
|
56006
56014
|
}
|
|
56007
|
-
let members =
|
|
56015
|
+
let members = getExportsOfSymbol(symbol);
|
|
56008
56016
|
let indexInfos;
|
|
56009
|
-
if (symbol
|
|
56010
|
-
|
|
56011
|
-
|
|
56012
|
-
|
|
56013
|
-
|
|
56014
|
-
|
|
56015
|
-
|
|
56016
|
-
|
|
56017
|
-
|
|
56018
|
-
});
|
|
56019
|
-
members = varsOnly;
|
|
56020
|
-
}
|
|
56017
|
+
if (symbol === globalThisSymbol) {
|
|
56018
|
+
const varsOnly = /* @__PURE__ */ new Map();
|
|
56019
|
+
members.forEach((p) => {
|
|
56020
|
+
var _a;
|
|
56021
|
+
if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) {
|
|
56022
|
+
varsOnly.set(p.escapedName, p);
|
|
56023
|
+
}
|
|
56024
|
+
});
|
|
56025
|
+
members = varsOnly;
|
|
56021
56026
|
}
|
|
56022
56027
|
let baseConstructorIndexInfo;
|
|
56023
56028
|
setStructuredTypeMembers(type, members, emptyArray, emptyArray, emptyArray);
|
|
@@ -68110,12 +68115,15 @@ ${lanes.join("\n")}
|
|
|
68110
68115
|
return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue);
|
|
68111
68116
|
}
|
|
68112
68117
|
const target = getReferenceCandidate(expr.right);
|
|
68113
|
-
|
|
68114
|
-
|
|
68115
|
-
if (
|
|
68118
|
+
if (containsMissingType(type) && isAccessExpression(reference) && isMatchingReference(reference.expression, target)) {
|
|
68119
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
68120
|
+
if (isTypeUsableAsPropertyName(leftType) && getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) {
|
|
68116
68121
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* NEUndefined */ : 65536 /* EQUndefined */);
|
|
68117
68122
|
}
|
|
68118
|
-
|
|
68123
|
+
}
|
|
68124
|
+
if (isMatchingReference(reference, target)) {
|
|
68125
|
+
const leftType = getTypeOfExpression(expr.left);
|
|
68126
|
+
if (isTypeUsableAsPropertyName(leftType)) {
|
|
68119
68127
|
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
68120
68128
|
}
|
|
68121
68129
|
}
|
|
@@ -74526,7 +74534,7 @@ ${lanes.join("\n")}
|
|
|
74526
74534
|
}
|
|
74527
74535
|
return restParameter.escapedName;
|
|
74528
74536
|
}
|
|
74529
|
-
function
|
|
74537
|
+
function getParameterIdentifierInfoAtPosition(signature, pos) {
|
|
74530
74538
|
var _a;
|
|
74531
74539
|
if (((_a = signature.declaration) == null ? void 0 : _a.kind) === 324 /* JSDocFunctionType */) {
|
|
74532
74540
|
return void 0;
|
|
@@ -74534,10 +74542,16 @@ ${lanes.join("\n")}
|
|
|
74534
74542
|
const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
|
|
74535
74543
|
if (pos < paramCount) {
|
|
74536
74544
|
const param = signature.parameters[pos];
|
|
74537
|
-
|
|
74545
|
+
const paramIdent = getParameterDeclarationIdentifier(param);
|
|
74546
|
+
return paramIdent ? {
|
|
74547
|
+
parameter: paramIdent,
|
|
74548
|
+
parameterName: param.escapedName,
|
|
74549
|
+
isRestParameter: false
|
|
74550
|
+
} : void 0;
|
|
74538
74551
|
}
|
|
74539
74552
|
const restParameter = signature.parameters[paramCount] || unknownSymbol;
|
|
74540
|
-
|
|
74553
|
+
const restIdent = getParameterDeclarationIdentifier(restParameter);
|
|
74554
|
+
if (!restIdent) {
|
|
74541
74555
|
return void 0;
|
|
74542
74556
|
}
|
|
74543
74557
|
const restType = getTypeOfSymbol(restParameter);
|
|
@@ -74546,18 +74560,19 @@ ${lanes.join("\n")}
|
|
|
74546
74560
|
const index = pos - paramCount;
|
|
74547
74561
|
const associatedName = associatedNames == null ? void 0 : associatedNames[index];
|
|
74548
74562
|
const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken);
|
|
74549
|
-
|
|
74550
|
-
|
|
74551
|
-
isRestTupleElement
|
|
74552
|
-
|
|
74563
|
+
if (associatedName) {
|
|
74564
|
+
Debug.assert(isIdentifier(associatedName.name));
|
|
74565
|
+
return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement };
|
|
74566
|
+
}
|
|
74567
|
+
return void 0;
|
|
74553
74568
|
}
|
|
74554
74569
|
if (pos === paramCount) {
|
|
74555
|
-
return
|
|
74570
|
+
return { parameter: restIdent, parameterName: restParameter.escapedName, isRestParameter: true };
|
|
74556
74571
|
}
|
|
74557
74572
|
return void 0;
|
|
74558
74573
|
}
|
|
74559
|
-
function
|
|
74560
|
-
return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name);
|
|
74574
|
+
function getParameterDeclarationIdentifier(symbol) {
|
|
74575
|
+
return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name) && symbol.valueDeclaration.name;
|
|
74561
74576
|
}
|
|
74562
74577
|
function isValidDeclarationForTupleLabel(d) {
|
|
74563
74578
|
return d.kind === 202 /* NamedTupleMember */ || isParameter(d) && d.name && isIdentifier(d.name);
|
|
@@ -154181,15 +154196,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154181
154196
|
}
|
|
154182
154197
|
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional = 3 /* All */, isAmbient = false) {
|
|
154183
154198
|
const declarations = symbol.getDeclarations();
|
|
154184
|
-
const declaration = declarations
|
|
154199
|
+
const declaration = firstOrUndefined(declarations);
|
|
154185
154200
|
const checker = context.program.getTypeChecker();
|
|
154186
154201
|
const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
|
|
154187
154202
|
const kind = (declaration == null ? void 0 : declaration.kind) ?? 171 /* PropertySignature */;
|
|
154188
|
-
const declarationName =
|
|
154189
|
-
getNameOfDeclaration(declaration),
|
|
154190
|
-
/*includeTrivia*/
|
|
154191
|
-
false
|
|
154192
|
-
);
|
|
154203
|
+
const declarationName = createDeclarationName(symbol, declaration);
|
|
154193
154204
|
const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
|
|
154194
154205
|
let modifierFlags = effectiveModifierFlags & 32 /* Static */;
|
|
154195
154206
|
modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
|
|
@@ -154340,6 +154351,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154340
154351
|
false
|
|
154341
154352
|
);
|
|
154342
154353
|
}
|
|
154354
|
+
function createDeclarationName(symbol2, declaration2) {
|
|
154355
|
+
if (getCheckFlags(symbol2) & 262144 /* Mapped */) {
|
|
154356
|
+
const nameType = symbol2.links.nameType;
|
|
154357
|
+
if (nameType && isTypeUsableAsPropertyName(nameType)) {
|
|
154358
|
+
return factory.createIdentifier(unescapeLeadingUnderscores(getPropertyNameFromType(nameType)));
|
|
154359
|
+
}
|
|
154360
|
+
}
|
|
154361
|
+
return getSynthesizedDeepClone(
|
|
154362
|
+
getNameOfDeclaration(declaration2),
|
|
154363
|
+
/*includeTrivia*/
|
|
154364
|
+
false
|
|
154365
|
+
);
|
|
154366
|
+
}
|
|
154343
154367
|
}
|
|
154344
154368
|
function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) {
|
|
154345
154369
|
const program = context.program;
|
|
@@ -163871,6 +163895,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163871
163895
|
function shouldShowLiteralParameterNameHintsOnly(preferences) {
|
|
163872
163896
|
return preferences.includeInlayParameterNameHints === "literals";
|
|
163873
163897
|
}
|
|
163898
|
+
function shouldUseInteractiveInlayHints(preferences) {
|
|
163899
|
+
return preferences.interactiveInlayHints === true;
|
|
163900
|
+
}
|
|
163874
163901
|
function provideInlayHints(context) {
|
|
163875
163902
|
const { file, program, span, cancellationToken, preferences } = context;
|
|
163876
163903
|
const sourceFileText = file.text;
|
|
@@ -163921,9 +163948,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163921
163948
|
function isSignatureSupportingReturnAnnotation(node) {
|
|
163922
163949
|
return isArrowFunction(node) || isFunctionExpression(node) || isFunctionDeclaration(node) || isMethodDeclaration(node) || isGetAccessorDeclaration(node);
|
|
163923
163950
|
}
|
|
163924
|
-
function addParameterHints(text, position, isFirstVariadicArgument) {
|
|
163951
|
+
function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile) {
|
|
163952
|
+
let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
|
|
163953
|
+
if (shouldUseInteractiveInlayHints(preferences)) {
|
|
163954
|
+
hintText = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
|
|
163955
|
+
} else {
|
|
163956
|
+
hintText += ":";
|
|
163957
|
+
}
|
|
163925
163958
|
result.push({
|
|
163926
|
-
text:
|
|
163959
|
+
text: hintText,
|
|
163927
163960
|
position,
|
|
163928
163961
|
kind: "Parameter" /* Parameter */,
|
|
163929
163962
|
whitespaceAfter: true
|
|
@@ -163931,7 +163964,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163931
163964
|
}
|
|
163932
163965
|
function addTypeHints(text, position) {
|
|
163933
163966
|
result.push({
|
|
163934
|
-
text: `: ${
|
|
163967
|
+
text: `: ${text.length > maxTypeHintLength ? text.substr(0, maxTypeHintLength - "...".length) + "..." : text}`,
|
|
163935
163968
|
position,
|
|
163936
163969
|
kind: "Type" /* Type */,
|
|
163937
163970
|
whitespaceBefore: true
|
|
@@ -163939,7 +163972,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163939
163972
|
}
|
|
163940
163973
|
function addEnumMemberValueHints(text, position) {
|
|
163941
163974
|
result.push({
|
|
163942
|
-
text: `= ${
|
|
163975
|
+
text: `= ${text}`,
|
|
163943
163976
|
position,
|
|
163944
163977
|
kind: "Enum" /* Enum */,
|
|
163945
163978
|
whitespaceBefore: true
|
|
@@ -163989,6 +164022,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163989
164022
|
return;
|
|
163990
164023
|
}
|
|
163991
164024
|
let signatureParamPos = 0;
|
|
164025
|
+
const sourceFile = shouldUseInteractiveInlayHints(preferences) ? expr.getSourceFile() : void 0;
|
|
163992
164026
|
for (const originalArg of args) {
|
|
163993
164027
|
const arg = skipParentheses(originalArg);
|
|
163994
164028
|
if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
|
|
@@ -164009,10 +164043,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164009
164043
|
}
|
|
164010
164044
|
}
|
|
164011
164045
|
}
|
|
164012
|
-
const
|
|
164046
|
+
const identifierInfo = checker.getParameterIdentifierInfoAtPosition(signature, signatureParamPos);
|
|
164013
164047
|
signatureParamPos = signatureParamPos + (spreadArgs || 1);
|
|
164014
|
-
if (
|
|
164015
|
-
const
|
|
164048
|
+
if (identifierInfo) {
|
|
164049
|
+
const { parameter, parameterName, isRestParameter: isFirstVariadicArgument } = identifierInfo;
|
|
164016
164050
|
const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
|
|
164017
164051
|
if (!isParameterNameNotSameAsArgument && !isFirstVariadicArgument) {
|
|
164018
164052
|
continue;
|
|
@@ -164021,7 +164055,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164021
164055
|
if (leadingCommentsContainsParameterName(arg, name)) {
|
|
164022
164056
|
continue;
|
|
164023
164057
|
}
|
|
164024
|
-
addParameterHints(name, originalArg.getStart(), isFirstVariadicArgument);
|
|
164058
|
+
addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument, sourceFile);
|
|
164025
164059
|
}
|
|
164026
164060
|
}
|
|
164027
164061
|
}
|
|
@@ -164127,12 +164161,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164127
164161
|
}
|
|
164128
164162
|
return printTypeInSingleLine(signatureParamType);
|
|
164129
164163
|
}
|
|
164130
|
-
function truncation(text, maxLength2) {
|
|
164131
|
-
if (text.length > maxLength2) {
|
|
164132
|
-
return text.substr(0, maxLength2 - "...".length) + "...";
|
|
164133
|
-
}
|
|
164134
|
-
return text;
|
|
164135
|
-
}
|
|
164136
164164
|
function printTypeInSingleLine(type) {
|
|
164137
164165
|
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
|
|
164138
164166
|
const printer = createPrinterWithRemoveComments();
|
|
@@ -164163,13 +164191,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
164163
164191
|
}
|
|
164164
164192
|
return true;
|
|
164165
164193
|
}
|
|
164194
|
+
function getNodeDisplayPart(text, node, sourceFile) {
|
|
164195
|
+
return {
|
|
164196
|
+
text,
|
|
164197
|
+
span: createTextSpanFromNode(node, sourceFile),
|
|
164198
|
+
file: sourceFile.fileName
|
|
164199
|
+
};
|
|
164200
|
+
}
|
|
164166
164201
|
}
|
|
164167
|
-
var
|
|
164202
|
+
var maxTypeHintLength, leadingParameterNameCommentRegexFactory;
|
|
164168
164203
|
var init_inlayHints = __esm({
|
|
164169
164204
|
"src/services/inlayHints.ts"() {
|
|
164170
164205
|
"use strict";
|
|
164171
164206
|
init_ts4();
|
|
164172
|
-
|
|
164207
|
+
maxTypeHintLength = 30;
|
|
164173
164208
|
leadingParameterNameCommentRegexFactory = (name) => {
|
|
164174
164209
|
return new RegExp(`^\\s?/\\*\\*?\\s?${name}\\s?\\*\\/\\s?$`);
|
|
164175
164210
|
};
|
|
@@ -166671,7 +166706,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166671
166706
|
}
|
|
166672
166707
|
return modifiers.size > 0 ? arrayFrom(modifiers.values()).join(",") : "" /* none */;
|
|
166673
166708
|
}
|
|
166674
|
-
function
|
|
166709
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias) {
|
|
166675
166710
|
var _a;
|
|
166676
166711
|
const displayParts = [];
|
|
166677
166712
|
let documentation = [];
|
|
@@ -166680,7 +166715,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166680
166715
|
let symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */;
|
|
166681
166716
|
let hasAddedSymbolInfo = false;
|
|
166682
166717
|
const isThisExpression = location.kind === 110 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location);
|
|
166683
|
-
let type;
|
|
166684
166718
|
let documentationFromAlias;
|
|
166685
166719
|
let tagsFromAlias;
|
|
166686
166720
|
let hasMultipleSignatures = false;
|
|
@@ -166709,7 +166743,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166709
166743
|
}
|
|
166710
166744
|
}
|
|
166711
166745
|
let signature;
|
|
166712
|
-
type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
|
|
166746
|
+
type ?? (type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location));
|
|
166713
166747
|
if (location.parent && location.parent.kind === 211 /* PropertyAccessExpression */) {
|
|
166714
166748
|
const right = location.parent.name;
|
|
166715
166749
|
if (right === location || right && right.getFullWidth() === 0) {
|
|
@@ -166924,12 +166958,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
166924
166958
|
if (declarationName && !hasAddedSymbolInfo) {
|
|
166925
166959
|
const isExternalModuleDeclaration = isModuleWithStringLiteralName(resolvedNode) && hasSyntacticModifier(resolvedNode, 2 /* Ambient */);
|
|
166926
166960
|
const shouldUseAliasName = symbol.name !== "default" && !isExternalModuleDeclaration;
|
|
166927
|
-
const resolvedInfo =
|
|
166961
|
+
const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
|
166928
166962
|
typeChecker,
|
|
166929
166963
|
resolvedSymbol,
|
|
166930
166964
|
getSourceFileOfNode(resolvedNode),
|
|
166931
166965
|
resolvedNode,
|
|
166932
166966
|
declarationName,
|
|
166967
|
+
type,
|
|
166933
166968
|
semanticMeaning,
|
|
166934
166969
|
shouldUseAliasName ? symbol : resolvedSymbol
|
|
166935
166970
|
);
|
|
@@ -167184,6 +167219,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
167184
167219
|
addRange(displayParts, typeParameterParts);
|
|
167185
167220
|
}
|
|
167186
167221
|
}
|
|
167222
|
+
function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) {
|
|
167223
|
+
return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
|
|
167224
|
+
typeChecker,
|
|
167225
|
+
symbol,
|
|
167226
|
+
sourceFile,
|
|
167227
|
+
enclosingDeclaration,
|
|
167228
|
+
location,
|
|
167229
|
+
/*type*/
|
|
167230
|
+
void 0,
|
|
167231
|
+
semanticMeaning,
|
|
167232
|
+
alias
|
|
167233
|
+
);
|
|
167234
|
+
}
|
|
167187
167235
|
function isLocalVariableOrFunction(symbol) {
|
|
167188
167236
|
if (symbol.parent) {
|
|
167189
167237
|
return false;
|
|
@@ -172499,6 +172547,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172499
172547
|
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
|
|
172500
172548
|
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
|
|
172501
172549
|
getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
|
|
172550
|
+
getPropertyNameFromType: () => getPropertyNameFromType,
|
|
172502
172551
|
getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
|
|
172503
172552
|
getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
|
|
172504
172553
|
getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType,
|
|
@@ -173331,6 +173380,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173331
173380
|
isTypeQueryNode: () => isTypeQueryNode,
|
|
173332
173381
|
isTypeReferenceNode: () => isTypeReferenceNode,
|
|
173333
173382
|
isTypeReferenceType: () => isTypeReferenceType,
|
|
173383
|
+
isTypeUsableAsPropertyName: () => isTypeUsableAsPropertyName,
|
|
173334
173384
|
isUMDExportSymbol: () => isUMDExportSymbol,
|
|
173335
173385
|
isUnaryExpression: () => isUnaryExpression,
|
|
173336
173386
|
isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.2";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230721`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -22618,10 +22618,14 @@ var Parser;
|
|
|
22618
22618
|
case 124 /* ProtectedKeyword */:
|
|
22619
22619
|
case 125 /* PublicKeyword */:
|
|
22620
22620
|
case 148 /* ReadonlyKeyword */:
|
|
22621
|
+
const previousToken = token();
|
|
22621
22622
|
nextToken();
|
|
22622
22623
|
if (scanner.hasPrecedingLineBreak()) {
|
|
22623
22624
|
return false;
|
|
22624
22625
|
}
|
|
22626
|
+
if (previousToken === 138 /* DeclareKeyword */ && token() === 156 /* TypeKeyword */) {
|
|
22627
|
+
return true;
|
|
22628
|
+
}
|
|
22625
22629
|
continue;
|
|
22626
22630
|
case 162 /* GlobalKeyword */:
|
|
22627
22631
|
nextToken();
|
|
@@ -22986,14 +22990,14 @@ var Parser;
|
|
|
22986
22990
|
function parseObjectBindingPattern() {
|
|
22987
22991
|
const pos = getNodePos();
|
|
22988
22992
|
parseExpected(19 /* OpenBraceToken */);
|
|
22989
|
-
const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
|
|
22993
|
+
const elements = allowInAnd(() => parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement));
|
|
22990
22994
|
parseExpected(20 /* CloseBraceToken */);
|
|
22991
22995
|
return finishNode(factory2.createObjectBindingPattern(elements), pos);
|
|
22992
22996
|
}
|
|
22993
22997
|
function parseArrayBindingPattern() {
|
|
22994
22998
|
const pos = getNodePos();
|
|
22995
22999
|
parseExpected(23 /* OpenBracketToken */);
|
|
22996
|
-
const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
|
|
23000
|
+
const elements = allowInAnd(() => parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement));
|
|
22997
23001
|
parseExpected(24 /* CloseBracketToken */);
|
|
22998
23002
|
return finishNode(factory2.createArrayBindingPattern(elements), pos);
|
|
22999
23003
|
}
|
|
@@ -23511,6 +23515,9 @@ var Parser;
|
|
|
23511
23515
|
}
|
|
23512
23516
|
function parseTypeAliasDeclaration(pos, hasJSDoc, modifiers) {
|
|
23513
23517
|
parseExpected(156 /* TypeKeyword */);
|
|
23518
|
+
if (scanner.hasPrecedingLineBreak()) {
|
|
23519
|
+
parseErrorAtCurrentToken(Diagnostics.Line_break_not_permitted_here);
|
|
23520
|
+
}
|
|
23514
23521
|
const name = parseIdentifier();
|
|
23515
23522
|
const typeParameters = parseTypeParameters();
|
|
23516
23523
|
parseExpected(64 /* EqualsToken */);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.2.0-dev.
|
|
5
|
+
"version": "5.2.0-dev.20230721",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "61bf78f3c2c8fd4d92e9c56109519edc2e38185f"
|
|
117
117
|
}
|