typescript 5.0.0-dev.20230216 → 5.0.0-dev.20230218
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 +141 -68
- package/lib/tsserver.js +247 -92
- package/lib/tsserverlibrary.d.ts +13 -0
- package/lib/tsserverlibrary.js +246 -92
- package/lib/typescript.d.ts +13 -0
- package/lib/typescript.js +245 -92
- package/lib/typingsInstaller.js +41 -46
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -1351,6 +1351,7 @@ __export(server_exports, {
|
|
|
1351
1351
|
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
|
|
1352
1352
|
isGlobalDeclaration: () => isGlobalDeclaration,
|
|
1353
1353
|
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
|
|
1354
|
+
isGrammarError: () => isGrammarError,
|
|
1354
1355
|
isHeritageClause: () => isHeritageClause,
|
|
1355
1356
|
isHoistedFunction: () => isHoistedFunction,
|
|
1356
1357
|
isHoistedVariableStatement: () => isHoistedVariableStatement,
|
|
@@ -2287,7 +2288,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2287
2288
|
|
|
2288
2289
|
// src/compiler/corePublic.ts
|
|
2289
2290
|
var versionMajorMinor = "5.0";
|
|
2290
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2291
|
+
var version = `${versionMajorMinor}.0-dev.20230218`;
|
|
2291
2292
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2292
2293
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2293
2294
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -11951,18 +11952,18 @@ function isIdentifierText(name, languageVersion, identifierVariant) {
|
|
|
11951
11952
|
return true;
|
|
11952
11953
|
}
|
|
11953
11954
|
function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Standard */, textInitial, onError, start2, length2) {
|
|
11954
|
-
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11955
|
+
var text = textInitial;
|
|
11956
|
+
var pos;
|
|
11957
|
+
var end;
|
|
11958
|
+
var startPos;
|
|
11959
|
+
var tokenPos;
|
|
11960
|
+
var token;
|
|
11961
|
+
var tokenValue;
|
|
11962
|
+
var tokenFlags;
|
|
11963
|
+
var commentDirectives;
|
|
11964
|
+
var inJSDocType = 0;
|
|
11964
11965
|
setText(text, start2, length2);
|
|
11965
|
-
|
|
11966
|
+
var scanner2 = {
|
|
11966
11967
|
getStartPos: () => startPos,
|
|
11967
11968
|
getTextPos: () => pos,
|
|
11968
11969
|
getToken: () => token,
|
|
@@ -15193,6 +15194,36 @@ function nodeIsMissing(node) {
|
|
|
15193
15194
|
function nodeIsPresent(node) {
|
|
15194
15195
|
return !nodeIsMissing(node);
|
|
15195
15196
|
}
|
|
15197
|
+
function isGrammarError(parent2, child) {
|
|
15198
|
+
if (isTypeParameterDeclaration(parent2))
|
|
15199
|
+
return child === parent2.expression;
|
|
15200
|
+
if (isClassStaticBlockDeclaration(parent2))
|
|
15201
|
+
return child === parent2.modifiers;
|
|
15202
|
+
if (isPropertySignature(parent2))
|
|
15203
|
+
return child === parent2.initializer;
|
|
15204
|
+
if (isPropertyDeclaration(parent2))
|
|
15205
|
+
return child === parent2.questionToken && isAutoAccessorPropertyDeclaration(parent2);
|
|
15206
|
+
if (isPropertyAssignment(parent2))
|
|
15207
|
+
return child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
|
|
15208
|
+
if (isShorthandPropertyAssignment(parent2))
|
|
15209
|
+
return child === parent2.equalsToken || child === parent2.modifiers || child === parent2.questionToken || child === parent2.exclamationToken || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
|
|
15210
|
+
if (isMethodDeclaration(parent2))
|
|
15211
|
+
return child === parent2.exclamationToken;
|
|
15212
|
+
if (isConstructorDeclaration(parent2))
|
|
15213
|
+
return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
|
|
15214
|
+
if (isGetAccessorDeclaration(parent2))
|
|
15215
|
+
return child === parent2.typeParameters || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
|
|
15216
|
+
if (isSetAccessorDeclaration(parent2))
|
|
15217
|
+
return child === parent2.typeParameters || child === parent2.type || isGrammarErrorElement(parent2.typeParameters, child, isTypeParameterDeclaration);
|
|
15218
|
+
if (isNamespaceExportDeclaration(parent2))
|
|
15219
|
+
return child === parent2.modifiers || isGrammarErrorElement(parent2.modifiers, child, isModifierLike);
|
|
15220
|
+
return false;
|
|
15221
|
+
}
|
|
15222
|
+
function isGrammarErrorElement(nodeArray, child, isElement) {
|
|
15223
|
+
if (!nodeArray || isArray(child) || !isElement(child))
|
|
15224
|
+
return false;
|
|
15225
|
+
return contains(nodeArray, child);
|
|
15226
|
+
}
|
|
15196
15227
|
function insertStatementsAfterPrologue(to, from, isPrologueDirective2) {
|
|
15197
15228
|
if (from === void 0 || from.length === 0)
|
|
15198
15229
|
return to;
|
|
@@ -29280,7 +29311,7 @@ function canHaveIllegalDecorators(node) {
|
|
|
29280
29311
|
}
|
|
29281
29312
|
function canHaveIllegalModifiers(node) {
|
|
29282
29313
|
const kind = node.kind;
|
|
29283
|
-
return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind ===
|
|
29314
|
+
return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
|
|
29284
29315
|
}
|
|
29285
29316
|
function isQuestionOrExclamationToken(node) {
|
|
29286
29317
|
return isQuestionToken(node) || isExclamationToken(node);
|
|
@@ -30323,22 +30354,22 @@ function parseJSDocTypeExpressionForTests(content, start2, length2) {
|
|
|
30323
30354
|
}
|
|
30324
30355
|
var Parser;
|
|
30325
30356
|
((Parser2) => {
|
|
30326
|
-
|
|
30357
|
+
var scanner2 = createScanner(
|
|
30327
30358
|
99 /* Latest */,
|
|
30328
30359
|
/*skipTrivia*/
|
|
30329
30360
|
true
|
|
30330
30361
|
);
|
|
30331
|
-
|
|
30332
|
-
|
|
30333
|
-
|
|
30334
|
-
|
|
30335
|
-
|
|
30336
|
-
|
|
30362
|
+
var disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
|
|
30363
|
+
var NodeConstructor2;
|
|
30364
|
+
var TokenConstructor2;
|
|
30365
|
+
var IdentifierConstructor2;
|
|
30366
|
+
var PrivateIdentifierConstructor2;
|
|
30367
|
+
var SourceFileConstructor2;
|
|
30337
30368
|
function countNode(node) {
|
|
30338
30369
|
nodeCount++;
|
|
30339
30370
|
return node;
|
|
30340
30371
|
}
|
|
30341
|
-
|
|
30372
|
+
var baseNodeFactory = {
|
|
30342
30373
|
createBaseSourceFileNode: (kind) => countNode(new SourceFileConstructor2(
|
|
30343
30374
|
kind,
|
|
30344
30375
|
/*pos*/
|
|
@@ -30375,25 +30406,25 @@ var Parser;
|
|
|
30375
30406
|
0
|
|
30376
30407
|
))
|
|
30377
30408
|
};
|
|
30378
|
-
|
|
30379
|
-
|
|
30380
|
-
|
|
30381
|
-
|
|
30382
|
-
|
|
30383
|
-
|
|
30384
|
-
|
|
30385
|
-
|
|
30386
|
-
|
|
30387
|
-
|
|
30388
|
-
|
|
30389
|
-
|
|
30390
|
-
|
|
30391
|
-
|
|
30392
|
-
|
|
30393
|
-
|
|
30394
|
-
|
|
30395
|
-
|
|
30396
|
-
|
|
30409
|
+
var factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
|
|
30410
|
+
var fileName;
|
|
30411
|
+
var sourceFlags;
|
|
30412
|
+
var sourceText;
|
|
30413
|
+
var languageVersion;
|
|
30414
|
+
var scriptKind;
|
|
30415
|
+
var languageVariant;
|
|
30416
|
+
var parseDiagnostics;
|
|
30417
|
+
var jsDocDiagnostics;
|
|
30418
|
+
var syntaxCursor;
|
|
30419
|
+
var currentToken;
|
|
30420
|
+
var nodeCount;
|
|
30421
|
+
var identifiers;
|
|
30422
|
+
var identifierCount;
|
|
30423
|
+
var parsingContext;
|
|
30424
|
+
var notParenthesizedArrow;
|
|
30425
|
+
var contextFlags;
|
|
30426
|
+
var topLevel = true;
|
|
30427
|
+
var parseErrorBeforeNextFinishedNode = false;
|
|
30397
30428
|
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride) {
|
|
30398
30429
|
var _a2;
|
|
30399
30430
|
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
|
|
@@ -32595,6 +32626,7 @@ var Parser;
|
|
|
32595
32626
|
const hasJSDoc = hasPrecedingJSDocComment();
|
|
32596
32627
|
const modifiers = parseModifiersForConstructorType();
|
|
32597
32628
|
const isConstructorType = parseOptional(103 /* NewKeyword */);
|
|
32629
|
+
Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
|
|
32598
32630
|
const typeParameters = parseTypeParameters();
|
|
32599
32631
|
const parameters = parseParameters(4 /* Type */);
|
|
32600
32632
|
const type = parseReturnType(
|
|
@@ -32603,8 +32635,6 @@ var Parser;
|
|
|
32603
32635
|
false
|
|
32604
32636
|
);
|
|
32605
32637
|
const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
|
|
32606
|
-
if (!isConstructorType)
|
|
32607
|
-
node.modifiers = modifiers;
|
|
32608
32638
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
32609
32639
|
}
|
|
32610
32640
|
function parseKeywordAndNoDot() {
|
|
@@ -33901,13 +33931,9 @@ var Parser;
|
|
|
33901
33931
|
function parseJsxClosingFragment(inExpressionContext) {
|
|
33902
33932
|
const pos = getNodePos();
|
|
33903
33933
|
parseExpected(30 /* LessThanSlashToken */);
|
|
33904
|
-
if (tokenIsIdentifierOrKeyword(token())) {
|
|
33905
|
-
parseErrorAtRange(parseJsxElementName(), Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
|
|
33906
|
-
}
|
|
33907
33934
|
if (parseExpected(
|
|
33908
33935
|
31 /* GreaterThanToken */,
|
|
33909
|
-
|
|
33910
|
-
void 0,
|
|
33936
|
+
Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment,
|
|
33911
33937
|
/*shouldAdvance*/
|
|
33912
33938
|
false
|
|
33913
33939
|
)) {
|
|
@@ -47161,6 +47187,7 @@ function createTypeChecker(host) {
|
|
|
47161
47187
|
let inlineLevel = 0;
|
|
47162
47188
|
let currentNode;
|
|
47163
47189
|
let varianceTypeParameter;
|
|
47190
|
+
let isInferencePartiallyBlocked = false;
|
|
47164
47191
|
const emptySymbols = createSymbolTable();
|
|
47165
47192
|
const arrayVariances = [1 /* Covariant */];
|
|
47166
47193
|
const compilerOptions = host.getCompilerOptions();
|
|
@@ -47592,7 +47619,9 @@ function createTypeChecker(host) {
|
|
|
47592
47619
|
toMarkSkip = toMarkSkip.parent;
|
|
47593
47620
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47594
47621
|
}
|
|
47622
|
+
isInferencePartiallyBlocked = true;
|
|
47595
47623
|
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
47624
|
+
isInferencePartiallyBlocked = false;
|
|
47596
47625
|
if (containingCall) {
|
|
47597
47626
|
let toMarkSkip = node;
|
|
47598
47627
|
do {
|
|
@@ -51866,7 +51895,7 @@ function createTypeChecker(host) {
|
|
|
51866
51895
|
return result;
|
|
51867
51896
|
}
|
|
51868
51897
|
function createAnonymousTypeNode(type2) {
|
|
51869
|
-
var _a3;
|
|
51898
|
+
var _a3, _b2;
|
|
51870
51899
|
const typeId = type2.id;
|
|
51871
51900
|
const symbol = type2.symbol;
|
|
51872
51901
|
if (symbol) {
|
|
@@ -51892,6 +51921,20 @@ function createTypeChecker(host) {
|
|
|
51892
51921
|
return visitAndTransformType(type2, createTypeNodeFromObjectType);
|
|
51893
51922
|
}
|
|
51894
51923
|
} else {
|
|
51924
|
+
const isInstantiationExpressionType = !!(getObjectFlags(type2) & 8388608 /* InstantiationExpressionType */);
|
|
51925
|
+
if (isInstantiationExpressionType) {
|
|
51926
|
+
const instantiationExpressionType = type2;
|
|
51927
|
+
if (isTypeQueryNode(instantiationExpressionType.node)) {
|
|
51928
|
+
const typeNode = serializeExistingTypeNode(context, instantiationExpressionType.node);
|
|
51929
|
+
if (typeNode) {
|
|
51930
|
+
return typeNode;
|
|
51931
|
+
}
|
|
51932
|
+
}
|
|
51933
|
+
if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
|
|
51934
|
+
return createElidedInformationPlaceholder(context);
|
|
51935
|
+
}
|
|
51936
|
+
return visitAndTransformType(type2, createTypeNodeFromObjectType);
|
|
51937
|
+
}
|
|
51895
51938
|
return createTypeNodeFromObjectType(type2);
|
|
51896
51939
|
}
|
|
51897
51940
|
function shouldWriteTypeOfFunctionSymbol() {
|
|
@@ -52400,7 +52443,7 @@ function createTypeChecker(host) {
|
|
|
52400
52443
|
);
|
|
52401
52444
|
}
|
|
52402
52445
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
52403
|
-
var _a2, _b, _c, _d;
|
|
52446
|
+
var _a2, _b, _c, _d, _e;
|
|
52404
52447
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
52405
52448
|
if (suppressAny)
|
|
52406
52449
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
@@ -52417,6 +52460,39 @@ function createTypeChecker(host) {
|
|
|
52417
52460
|
/*skipUnionExpanding*/
|
|
52418
52461
|
true
|
|
52419
52462
|
)[0];
|
|
52463
|
+
let cleanup;
|
|
52464
|
+
if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
|
|
52465
|
+
const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
|
|
52466
|
+
Debug.assertOptionalNode(existingFakeScope, isBlock);
|
|
52467
|
+
const locals = (_a2 = existingFakeScope == null ? void 0 : existingFakeScope.locals) != null ? _a2 : createSymbolTable();
|
|
52468
|
+
let newLocals;
|
|
52469
|
+
for (const param of expandedParams) {
|
|
52470
|
+
if (!locals.has(param.escapedName)) {
|
|
52471
|
+
newLocals = append(newLocals, param.escapedName);
|
|
52472
|
+
locals.set(param.escapedName, param);
|
|
52473
|
+
}
|
|
52474
|
+
}
|
|
52475
|
+
if (newLocals) {
|
|
52476
|
+
let removeNewLocals2 = function() {
|
|
52477
|
+
forEach(newLocals, (s) => locals.delete(s));
|
|
52478
|
+
};
|
|
52479
|
+
var removeNewLocals = removeNewLocals2;
|
|
52480
|
+
if (existingFakeScope) {
|
|
52481
|
+
cleanup = removeNewLocals2;
|
|
52482
|
+
} else {
|
|
52483
|
+
const fakeScope = parseNodeFactory.createBlock(emptyArray);
|
|
52484
|
+
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
|
|
52485
|
+
fakeScope.locals = locals;
|
|
52486
|
+
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
52487
|
+
setParent(fakeScope, saveEnclosingDeclaration);
|
|
52488
|
+
context.enclosingDeclaration = fakeScope;
|
|
52489
|
+
cleanup = () => {
|
|
52490
|
+
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
52491
|
+
removeNewLocals2();
|
|
52492
|
+
};
|
|
52493
|
+
}
|
|
52494
|
+
}
|
|
52495
|
+
}
|
|
52420
52496
|
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports));
|
|
52421
52497
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
52422
52498
|
if (thisParameter) {
|
|
@@ -52442,11 +52518,11 @@ function createTypeChecker(host) {
|
|
|
52442
52518
|
const flags = modifiersToFlags(modifiers);
|
|
52443
52519
|
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
|
|
52444
52520
|
}
|
|
52445
|
-
const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (
|
|
52521
|
+
const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration(
|
|
52446
52522
|
modifiers,
|
|
52447
52523
|
/*asteriskToken*/
|
|
52448
52524
|
void 0,
|
|
52449
|
-
(
|
|
52525
|
+
(_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
|
|
52450
52526
|
/*questionToken*/
|
|
52451
52527
|
void 0,
|
|
52452
52528
|
typeParameters,
|
|
@@ -52461,14 +52537,14 @@ function createTypeChecker(host) {
|
|
|
52461
52537
|
void 0
|
|
52462
52538
|
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
|
|
52463
52539
|
modifiers,
|
|
52464
|
-
(
|
|
52540
|
+
(_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
|
|
52465
52541
|
parameters,
|
|
52466
52542
|
returnTypeNode,
|
|
52467
52543
|
/*body*/
|
|
52468
52544
|
void 0
|
|
52469
52545
|
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
|
|
52470
52546
|
modifiers,
|
|
52471
|
-
(
|
|
52547
|
+
(_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
|
|
52472
52548
|
parameters,
|
|
52473
52549
|
/*body*/
|
|
52474
52550
|
void 0
|
|
@@ -52503,6 +52579,7 @@ function createTypeChecker(host) {
|
|
|
52503
52579
|
if (typeArguments) {
|
|
52504
52580
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
52505
52581
|
}
|
|
52582
|
+
cleanup == null ? void 0 : cleanup();
|
|
52506
52583
|
return node;
|
|
52507
52584
|
}
|
|
52508
52585
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -53117,9 +53194,12 @@ function createTypeChecker(host) {
|
|
|
53117
53194
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
53118
53195
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
53119
53196
|
}
|
|
53197
|
+
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
53198
|
+
return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
|
|
53199
|
+
}
|
|
53120
53200
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
53121
53201
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
53122
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
53202
|
+
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
53123
53203
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
53124
53204
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
53125
53205
|
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
@@ -53151,7 +53231,8 @@ function createTypeChecker(host) {
|
|
|
53151
53231
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
53152
53232
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
53153
53233
|
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
|
53154
|
-
|
|
53234
|
+
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
53235
|
+
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
53155
53236
|
const annotated = getTypeFromTypeNode(annotation);
|
|
53156
53237
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
53157
53238
|
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
|
@@ -57638,6 +57719,7 @@ function createTypeChecker(host) {
|
|
|
57638
57719
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
57639
57720
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
57640
57721
|
const nameType = getNameTypeFromMappedType(type.target || type);
|
|
57722
|
+
const isFilteringMappedType = nameType && isTypeAssignableTo(nameType, typeParameter);
|
|
57641
57723
|
const templateType = getTemplateTypeFromMappedType(type.target || type);
|
|
57642
57724
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
57643
57725
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
@@ -57675,7 +57757,7 @@ function createTypeChecker(host) {
|
|
|
57675
57757
|
prop.links.keyType = keyType;
|
|
57676
57758
|
if (modifiersProp) {
|
|
57677
57759
|
prop.links.syntheticOrigin = modifiersProp;
|
|
57678
|
-
prop.declarations = nameType
|
|
57760
|
+
prop.declarations = !nameType || isFilteringMappedType ? modifiersProp.declarations : void 0;
|
|
57679
57761
|
}
|
|
57680
57762
|
members.set(propName, prop);
|
|
57681
57763
|
}
|
|
@@ -66407,6 +66489,9 @@ function createTypeChecker(host) {
|
|
|
66407
66489
|
const key = `B${getTypeId(type)}`;
|
|
66408
66490
|
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
66409
66491
|
}
|
|
66492
|
+
function getBaseTypeOfLiteralTypeForComparison(type) {
|
|
66493
|
+
return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
|
|
66494
|
+
}
|
|
66410
66495
|
function getWidenedLiteralType(type) {
|
|
66411
66496
|
return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
|
|
66412
66497
|
}
|
|
@@ -74231,7 +74316,7 @@ function createTypeChecker(host) {
|
|
|
74231
74316
|
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
|
|
74232
74317
|
const isDecorator2 = node.kind === 167 /* Decorator */;
|
|
74233
74318
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
74234
|
-
const reportErrors2 = !candidatesOutArray;
|
|
74319
|
+
const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
|
|
74235
74320
|
let typeArguments;
|
|
74236
74321
|
if (!isDecorator2 && !isSuperCall(node)) {
|
|
74237
74322
|
typeArguments = node.typeArguments;
|
|
@@ -77472,8 +77557,8 @@ function createTypeChecker(host) {
|
|
|
77472
77557
|
case 32 /* LessThanEqualsToken */:
|
|
77473
77558
|
case 33 /* GreaterThanEqualsToken */:
|
|
77474
77559
|
if (checkForDisallowedESSymbolOperand(operator)) {
|
|
77475
|
-
leftType =
|
|
77476
|
-
rightType =
|
|
77560
|
+
leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
|
|
77561
|
+
rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
|
|
77477
77562
|
reportOperatorErrorUnless((left2, right2) => {
|
|
77478
77563
|
if (isTypeAny(left2) || isTypeAny(right2)) {
|
|
77479
77564
|
return true;
|
|
@@ -79309,6 +79394,17 @@ function createTypeChecker(host) {
|
|
|
79309
79394
|
lastSeenNonAmbientDeclaration = node;
|
|
79310
79395
|
}
|
|
79311
79396
|
}
|
|
79397
|
+
if (isInJSFile(current) && isFunctionLike(current) && current.jsDoc) {
|
|
79398
|
+
for (const node2 of current.jsDoc) {
|
|
79399
|
+
if (node2.tags) {
|
|
79400
|
+
for (const tag of node2.tags) {
|
|
79401
|
+
if (isJSDocOverloadTag(tag)) {
|
|
79402
|
+
hasOverloads = true;
|
|
79403
|
+
}
|
|
79404
|
+
}
|
|
79405
|
+
}
|
|
79406
|
+
}
|
|
79407
|
+
}
|
|
79312
79408
|
}
|
|
79313
79409
|
}
|
|
79314
79410
|
if (multipleConstructorImplementation) {
|
|
@@ -79346,8 +79442,9 @@ function createTypeChecker(host) {
|
|
|
79346
79442
|
const bodySignature = getSignatureFromDeclaration(bodyDeclaration);
|
|
79347
79443
|
for (const signature of signatures) {
|
|
79348
79444
|
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
|
79445
|
+
const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
|
|
79349
79446
|
addRelatedInfo(
|
|
79350
|
-
error(
|
|
79447
|
+
error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
|
|
79351
79448
|
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
|
|
79352
79449
|
);
|
|
79353
79450
|
break;
|
|
@@ -82380,20 +82477,19 @@ function createTypeChecker(host) {
|
|
|
82380
82477
|
}
|
|
82381
82478
|
}
|
|
82382
82479
|
}
|
|
82383
|
-
function getMemberOverrideModifierStatus(node, member) {
|
|
82480
|
+
function getMemberOverrideModifierStatus(node, member, memberSymbol) {
|
|
82384
82481
|
if (!member.name) {
|
|
82385
82482
|
return 0 /* Ok */;
|
|
82386
82483
|
}
|
|
82387
|
-
const
|
|
82388
|
-
const type = getDeclaredTypeOfSymbol(
|
|
82484
|
+
const classSymbol = getSymbolOfDeclaration(node);
|
|
82485
|
+
const type = getDeclaredTypeOfSymbol(classSymbol);
|
|
82389
82486
|
const typeWithThis = getTypeWithThisArgument(type);
|
|
82390
|
-
const staticType = getTypeOfSymbol(
|
|
82487
|
+
const staticType = getTypeOfSymbol(classSymbol);
|
|
82391
82488
|
const baseTypeNode = getEffectiveBaseTypeNode(node);
|
|
82392
82489
|
const baseTypes = baseTypeNode && getBaseTypes(type);
|
|
82393
82490
|
const baseWithThis = (baseTypes == null ? void 0 : baseTypes.length) ? getTypeWithThisArgument(first(baseTypes), type.thisType) : void 0;
|
|
82394
82491
|
const baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
82395
82492
|
const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member, 16384 /* Override */);
|
|
82396
|
-
const memberName = unescapeLeadingUnderscores(getTextOfPropertyName(member.name));
|
|
82397
82493
|
return checkMemberForOverrideModifier(
|
|
82398
82494
|
node,
|
|
82399
82495
|
staticType,
|
|
@@ -82406,7 +82502,7 @@ function createTypeChecker(host) {
|
|
|
82406
82502
|
isStatic(member),
|
|
82407
82503
|
/* memberIsParameterProperty */
|
|
82408
82504
|
false,
|
|
82409
|
-
|
|
82505
|
+
symbolName(memberSymbol)
|
|
82410
82506
|
);
|
|
82411
82507
|
}
|
|
82412
82508
|
function getTargetSymbol(s) {
|
|
@@ -85963,7 +86059,6 @@ function createTypeChecker(host) {
|
|
|
85963
86059
|
case 299 /* PropertyAssignment */:
|
|
85964
86060
|
case 300 /* ShorthandPropertyAssignment */:
|
|
85965
86061
|
case 267 /* NamespaceExportDeclaration */:
|
|
85966
|
-
case 181 /* FunctionType */:
|
|
85967
86062
|
case 279 /* MissingDeclaration */:
|
|
85968
86063
|
return find(node.modifiers, isModifier);
|
|
85969
86064
|
default:
|
|
@@ -92381,7 +92476,16 @@ function transformClassFields(context) {
|
|
|
92381
92476
|
visitNode(node.initializer, (child) => namedEvaluationVisitor(child, referencedName), isExpression)
|
|
92382
92477
|
);
|
|
92383
92478
|
}
|
|
92384
|
-
return
|
|
92479
|
+
return factory2.updatePropertyDeclaration(
|
|
92480
|
+
node,
|
|
92481
|
+
visitNodes2(node.modifiers, modifierVisitor, isModifier),
|
|
92482
|
+
visitNode(node.name, propertyNameVisitor, isPropertyName),
|
|
92483
|
+
/*questionOrExclamationToken*/
|
|
92484
|
+
void 0,
|
|
92485
|
+
/*type*/
|
|
92486
|
+
void 0,
|
|
92487
|
+
visitNode(node.initializer, visitor, isExpression)
|
|
92488
|
+
);
|
|
92385
92489
|
}
|
|
92386
92490
|
function transformPublicFieldInitializer(node) {
|
|
92387
92491
|
if (shouldTransformInitializers && !isAutoAccessorPropertyDeclaration(node)) {
|
|
@@ -135428,7 +135532,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
135428
135532
|
options.triggerCharacter,
|
|
135429
135533
|
options.triggerKind,
|
|
135430
135534
|
cancellationToken,
|
|
135431
|
-
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host)
|
|
135535
|
+
formattingSettings && ts_formatting_exports.getFormatContext(formattingSettings, host),
|
|
135536
|
+
options.includeSymbol
|
|
135432
135537
|
);
|
|
135433
135538
|
}
|
|
135434
135539
|
function getCompletionEntryDetails2(fileName, position, name, formattingOptions, source, preferences = emptyOptions, data) {
|
|
@@ -147236,7 +147341,14 @@ function updatePropertyDeclaration(changeTracker, file, declaration, type, field
|
|
|
147236
147341
|
changeTracker.replaceNode(file, declaration, property);
|
|
147237
147342
|
}
|
|
147238
147343
|
function updatePropertyAssignmentDeclaration(changeTracker, file, declaration, fieldName) {
|
|
147239
|
-
|
|
147344
|
+
let assignment = factory.updatePropertyAssignment(declaration, fieldName, declaration.initializer);
|
|
147345
|
+
if (assignment.modifiers || assignment.questionToken || assignment.exclamationToken) {
|
|
147346
|
+
if (assignment === declaration)
|
|
147347
|
+
assignment = factory.cloneNode(assignment);
|
|
147348
|
+
assignment.modifiers = void 0;
|
|
147349
|
+
assignment.questionToken = void 0;
|
|
147350
|
+
assignment.exclamationToken = void 0;
|
|
147351
|
+
}
|
|
147240
147352
|
changeTracker.replacePropertyAssignment(file, declaration, assignment);
|
|
147241
147353
|
}
|
|
147242
147354
|
function updateFieldDeclaration(changeTracker, file, declaration, type, fieldName, modifiers) {
|
|
@@ -148177,6 +148289,7 @@ var SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
|
|
148177
148289
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["TypeOnlyAlias"] = 64] = "TypeOnlyAlias";
|
|
148178
148290
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["ObjectLiteralMethod"] = 128] = "ObjectLiteralMethod";
|
|
148179
148291
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["Ignore"] = 256] = "Ignore";
|
|
148292
|
+
SymbolOriginInfoKind2[SymbolOriginInfoKind2["ComputedPropertyName"] = 512] = "ComputedPropertyName";
|
|
148180
148293
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberNoExport"] = 2 /* SymbolMember */] = "SymbolMemberNoExport";
|
|
148181
148294
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberExport"] = 6] = "SymbolMemberExport";
|
|
148182
148295
|
return SymbolOriginInfoKind2;
|
|
@@ -148194,7 +148307,7 @@ function originIsResolvedExport(origin) {
|
|
|
148194
148307
|
return !!(origin && origin.kind === 32 /* ResolvedExport */);
|
|
148195
148308
|
}
|
|
148196
148309
|
function originIncludesSymbolName(origin) {
|
|
148197
|
-
return originIsExport(origin) || originIsResolvedExport(origin);
|
|
148310
|
+
return originIsExport(origin) || originIsResolvedExport(origin) || originIsComputedPropertyName(origin);
|
|
148198
148311
|
}
|
|
148199
148312
|
function originIsPackageJsonImport(origin) {
|
|
148200
148313
|
return (originIsExport(origin) || originIsResolvedExport(origin)) && !!origin.isFromPackageJson;
|
|
@@ -148214,6 +148327,9 @@ function originIsObjectLiteralMethod(origin) {
|
|
|
148214
148327
|
function originIsIgnore(origin) {
|
|
148215
148328
|
return !!(origin && origin.kind & 256 /* Ignore */);
|
|
148216
148329
|
}
|
|
148330
|
+
function originIsComputedPropertyName(origin) {
|
|
148331
|
+
return !!(origin && origin.kind & 512 /* ComputedPropertyName */);
|
|
148332
|
+
}
|
|
148217
148333
|
function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
|
|
148218
148334
|
var _a2, _b, _c;
|
|
148219
148335
|
const start2 = timestamp();
|
|
@@ -148256,7 +148372,7 @@ function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position,
|
|
|
148256
148372
|
return result2 || (needsFullResolution ? "failed" : "skipped");
|
|
148257
148373
|
}
|
|
148258
148374
|
}
|
|
148259
|
-
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext) {
|
|
148375
|
+
function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) {
|
|
148260
148376
|
var _a2;
|
|
148261
148377
|
const { previousToken } = getRelevantTokens(position, sourceFile);
|
|
148262
148378
|
if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) {
|
|
@@ -148278,7 +148394,7 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
|
|
|
148278
148394
|
} else {
|
|
148279
148395
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.clear();
|
|
148280
148396
|
}
|
|
148281
|
-
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
|
|
148397
|
+
const stringCompletions = ts_Completions_StringCompletions_exports.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences, includeSymbol);
|
|
148282
148398
|
if (stringCompletions) {
|
|
148283
148399
|
return stringCompletions;
|
|
148284
148400
|
}
|
|
@@ -148303,7 +148419,7 @@ function getCompletionsAtPosition(host, program, log, sourceFile, position, pref
|
|
|
148303
148419
|
}
|
|
148304
148420
|
switch (completionData.kind) {
|
|
148305
148421
|
case 0 /* Data */:
|
|
148306
|
-
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position);
|
|
148422
|
+
const response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol);
|
|
148307
148423
|
if (response == null ? void 0 : response.isIncomplete) {
|
|
148308
148424
|
incompleteCompletionsCache == null ? void 0 : incompleteCompletionsCache.set(response);
|
|
148309
148425
|
}
|
|
@@ -148433,7 +148549,7 @@ function keywordFiltersFromSyntaxKind(keywordCompletion) {
|
|
|
148433
148549
|
function getOptionalReplacementSpan(location) {
|
|
148434
148550
|
return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0;
|
|
148435
148551
|
}
|
|
148436
|
-
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) {
|
|
148552
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) {
|
|
148437
148553
|
const {
|
|
148438
148554
|
symbols,
|
|
148439
148555
|
contextToken,
|
|
@@ -148507,7 +148623,8 @@ function completionInfoFromData(sourceFile, host, program, compilerOptions, log,
|
|
|
148507
148623
|
symbolToOriginInfoMap,
|
|
148508
148624
|
symbolToSortTextMap,
|
|
148509
148625
|
isJsxIdentifierExpected,
|
|
148510
|
-
isRightOfOpenTag
|
|
148626
|
+
isRightOfOpenTag,
|
|
148627
|
+
includeSymbol
|
|
148511
148628
|
);
|
|
148512
148629
|
if (keywordFilters !== 0 /* None */) {
|
|
148513
148630
|
for (const keywordEntry of getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && isSourceFileJS(sourceFile))) {
|
|
@@ -148756,7 +148873,7 @@ function completionNameForLiteral(sourceFile, preferences, literal) {
|
|
|
148756
148873
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
148757
148874
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
148758
148875
|
}
|
|
148759
|
-
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
148876
|
+
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
|
|
148760
148877
|
let insertText;
|
|
148761
148878
|
let replacementSpan = getReplacementSpanForContextToken(replacementToken);
|
|
148762
148879
|
let data;
|
|
@@ -148800,7 +148917,9 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
148800
148917
|
}
|
|
148801
148918
|
awaitText += `(await ${propertyAccessToConvert.expression.getText()})`;
|
|
148802
148919
|
insertText = needsConvertPropertyAccess ? `${awaitText}${insertText}` : `${awaitText}${insertQuestionDot ? "?." : "."}${insertText}`;
|
|
148803
|
-
|
|
148920
|
+
const isInAwaitExpression = tryCast(propertyAccessToConvert.parent, isAwaitExpression);
|
|
148921
|
+
const wrapNode = isInAwaitExpression ? propertyAccessToConvert.parent : propertyAccessToConvert.expression;
|
|
148922
|
+
replacementSpan = createTextSpanFromBounds(wrapNode.getStart(sourceFile), propertyAccessToConvert.end);
|
|
148804
148923
|
}
|
|
148805
148924
|
if (originIsResolvedExport(origin)) {
|
|
148806
148925
|
sourceDisplay = [textPart(origin.moduleSpecifier)];
|
|
@@ -148868,7 +148987,8 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken,
|
|
|
148868
148987
|
isSnippet,
|
|
148869
148988
|
isPackageJsonImport: originIsPackageJsonImport(origin) || void 0,
|
|
148870
148989
|
isImportStatementCompletion: !!importStatementCompletion || void 0,
|
|
148871
|
-
data
|
|
148990
|
+
data,
|
|
148991
|
+
...includeSymbol ? { symbol } : void 0
|
|
148872
148992
|
};
|
|
148873
148993
|
}
|
|
148874
148994
|
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
@@ -148936,7 +149056,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
148936
149056
|
if (isAbstract) {
|
|
148937
149057
|
requiredModifiers |= 256 /* Abstract */;
|
|
148938
149058
|
}
|
|
148939
|
-
if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
|
|
149059
|
+
if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node, symbol) === 1 /* NeedsOverride */) {
|
|
148940
149060
|
requiredModifiers |= 16384 /* Override */;
|
|
148941
149061
|
}
|
|
148942
149062
|
if (!completionNodes.length) {
|
|
@@ -149338,7 +149458,7 @@ function getSourceFromOrigin(origin) {
|
|
|
149338
149458
|
return "TypeOnlyAlias/" /* TypeOnlyAlias */;
|
|
149339
149459
|
}
|
|
149340
149460
|
}
|
|
149341
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) {
|
|
149461
|
+
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
|
|
149342
149462
|
var _a2;
|
|
149343
149463
|
const start2 = timestamp();
|
|
149344
149464
|
const variableDeclaration = getVariableDeclaration(location);
|
|
@@ -149378,7 +149498,8 @@ function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, con
|
|
|
149378
149498
|
kind,
|
|
149379
149499
|
formatContext,
|
|
149380
149500
|
isJsxIdentifierExpected,
|
|
149381
|
-
isRightOfOpenTag
|
|
149501
|
+
isRightOfOpenTag,
|
|
149502
|
+
includeSymbol
|
|
149382
149503
|
);
|
|
149383
149504
|
if (!entry) {
|
|
149384
149505
|
continue;
|
|
@@ -149529,7 +149650,8 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
|
|
|
149529
149650
|
case "symbol": {
|
|
149530
149651
|
const { symbol, location, contextToken: contextToken2, origin, previousToken: previousToken2 } = symbolCompletion;
|
|
149531
149652
|
const { codeActions, sourceDisplay } = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken2, formatContext, preferences, data, source, cancellationToken);
|
|
149532
|
-
|
|
149653
|
+
const symbolName2 = originIsComputedPropertyName(origin) ? origin.symbolName : symbol.name;
|
|
149654
|
+
return createCompletionDetailsForSymbol(symbol, symbolName2, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay);
|
|
149533
149655
|
}
|
|
149534
149656
|
case "literal": {
|
|
149535
149657
|
const { literal } = symbolCompletion;
|
|
@@ -149580,12 +149702,12 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
|
|
|
149580
149702
|
function createSimpleDetails(name, kind, kind2) {
|
|
149581
149703
|
return createCompletionDetails(name, "" /* none */, kind, [displayPart(name, kind2)]);
|
|
149582
149704
|
}
|
|
149583
|
-
function createCompletionDetailsForSymbol(symbol, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) {
|
|
149705
|
+
function createCompletionDetailsForSymbol(symbol, name, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) {
|
|
149584
149706
|
const { displayParts, documentation, symbolKind, tags } = checker.runWithCancellationToken(
|
|
149585
149707
|
cancellationToken,
|
|
149586
149708
|
(checker2) => ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(checker2, symbol, sourceFile, location, location, 7 /* All */)
|
|
149587
149709
|
);
|
|
149588
|
-
return createCompletionDetails(
|
|
149710
|
+
return createCompletionDetails(name, ts_SymbolDisplay_exports.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay);
|
|
149589
149711
|
}
|
|
149590
149712
|
function createCompletionDetails(name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source) {
|
|
149591
149713
|
return { name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source, sourceDisplay: source };
|
|
@@ -150692,6 +150814,16 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
150692
150814
|
return classElementModifierFlags & 32 /* Static */ ? (type == null ? void 0 : type.symbol) && typeChecker.getPropertiesOfType(typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl)) : type && typeChecker.getPropertiesOfType(type);
|
|
150693
150815
|
});
|
|
150694
150816
|
symbols = concatenate(symbols, filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags));
|
|
150817
|
+
forEach(symbols, (symbol, index) => {
|
|
150818
|
+
const declaration = symbol == null ? void 0 : symbol.valueDeclaration;
|
|
150819
|
+
if (declaration && isClassElement(declaration) && declaration.name && isComputedPropertyName(declaration.name)) {
|
|
150820
|
+
const origin = {
|
|
150821
|
+
kind: 512 /* ComputedPropertyName */,
|
|
150822
|
+
symbolName: typeChecker.symbolToString(symbol)
|
|
150823
|
+
};
|
|
150824
|
+
symbolToOriginInfoMap[index] = origin;
|
|
150825
|
+
}
|
|
150826
|
+
});
|
|
150695
150827
|
}
|
|
150696
150828
|
return 1 /* Success */;
|
|
150697
150829
|
}
|
|
@@ -151076,7 +151208,7 @@ function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, js
|
|
|
151076
151208
|
}
|
|
151077
151209
|
switch (kind) {
|
|
151078
151210
|
case 3 /* MemberLike */:
|
|
151079
|
-
return void 0;
|
|
151211
|
+
return originIsComputedPropertyName(origin) ? { name: origin.symbolName, needsConvertPropertyAccess: false } : void 0;
|
|
151080
151212
|
case 0 /* ObjectPropertyDeclaration */:
|
|
151081
151213
|
return { name: JSON.stringify(name), needsConvertPropertyAccess: false };
|
|
151082
151214
|
case 2 /* PropertyAccess */:
|
|
@@ -151577,7 +151709,7 @@ function createNameAndKindSet() {
|
|
|
151577
151709
|
values: map2.values.bind(map2)
|
|
151578
151710
|
};
|
|
151579
151711
|
}
|
|
151580
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
151712
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences, includeSymbol) {
|
|
151581
151713
|
if (isInReferenceComment(sourceFile, position)) {
|
|
151582
151714
|
const entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
151583
151715
|
return entries && convertPathCompletions(entries);
|
|
@@ -151586,10 +151718,10 @@ function getStringLiteralCompletions(sourceFile, position, contextToken, options
|
|
|
151586
151718
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
151587
151719
|
return void 0;
|
|
151588
151720
|
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
151589
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position);
|
|
151721
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
151590
151722
|
}
|
|
151591
151723
|
}
|
|
151592
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position) {
|
|
151724
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol) {
|
|
151593
151725
|
if (completion === void 0) {
|
|
151594
151726
|
return void 0;
|
|
151595
151727
|
}
|
|
@@ -151615,7 +151747,28 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
|
|
|
151615
151747
|
preferences,
|
|
151616
151748
|
options,
|
|
151617
151749
|
/*formatContext*/
|
|
151618
|
-
void 0
|
|
151750
|
+
void 0,
|
|
151751
|
+
/*isTypeOnlyLocation */
|
|
151752
|
+
void 0,
|
|
151753
|
+
/*propertyAccessToConvert*/
|
|
151754
|
+
void 0,
|
|
151755
|
+
/*jsxIdentifierExpected*/
|
|
151756
|
+
void 0,
|
|
151757
|
+
/*isJsxInitializer*/
|
|
151758
|
+
void 0,
|
|
151759
|
+
/*importStatementCompletion*/
|
|
151760
|
+
void 0,
|
|
151761
|
+
/*recommendedCompletion*/
|
|
151762
|
+
void 0,
|
|
151763
|
+
/*symbolToOriginInfoMap*/
|
|
151764
|
+
void 0,
|
|
151765
|
+
/*symbolToSortTextMap*/
|
|
151766
|
+
void 0,
|
|
151767
|
+
/*isJsxIdentifierExpected*/
|
|
151768
|
+
void 0,
|
|
151769
|
+
/*isRightOfOpenTag*/
|
|
151770
|
+
void 0,
|
|
151771
|
+
includeSymbol
|
|
151619
151772
|
);
|
|
151620
151773
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan, entries };
|
|
151621
151774
|
}
|
|
@@ -151647,7 +151800,7 @@ function stringLiteralCompletionDetails(name, location, completion, sourceFile,
|
|
|
151647
151800
|
}
|
|
151648
151801
|
case 1 /* Properties */: {
|
|
151649
151802
|
const match = find(completion.symbols, (s) => s.name === name);
|
|
151650
|
-
return match && createCompletionDetailsForSymbol(match, checker, sourceFile, location, cancellationToken);
|
|
151803
|
+
return match && createCompletionDetailsForSymbol(match, match.name, checker, sourceFile, location, cancellationToken);
|
|
151651
151804
|
}
|
|
151652
151805
|
case 2 /* Types */:
|
|
151653
151806
|
return find(completion.types, (t) => t.value === name) ? createCompletionDetails(name, "" /* none */, "string" /* string */, [textPart(name)]) : void 0;
|
|
@@ -166366,7 +166519,7 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
166366
166519
|
}
|
|
166367
166520
|
function processChildNode(child, inheritedIndentation, parent2, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
166368
166521
|
Debug.assert(!nodeIsSynthesized(child));
|
|
166369
|
-
if (nodeIsMissing(child)) {
|
|
166522
|
+
if (nodeIsMissing(child) || isGrammarError(parent2, child)) {
|
|
166370
166523
|
return inheritedIndentation;
|
|
166371
166524
|
}
|
|
166372
166525
|
const childStartPos = child.getStart(sourceFile);
|
|
@@ -168779,6 +168932,7 @@ __export(ts_exports3, {
|
|
|
168779
168932
|
isGetOrSetAccessorDeclaration: () => isGetOrSetAccessorDeclaration,
|
|
168780
168933
|
isGlobalDeclaration: () => isGlobalDeclaration,
|
|
168781
168934
|
isGlobalScopeAugmentation: () => isGlobalScopeAugmentation,
|
|
168935
|
+
isGrammarError: () => isGrammarError,
|
|
168782
168936
|
isHeritageClause: () => isHeritageClause,
|
|
168783
168937
|
isHoistedFunction: () => isHoistedFunction,
|
|
168784
168938
|
isHoistedVariableStatement: () => isHoistedVariableStatement,
|
|
@@ -182728,6 +182882,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
182728
182882
|
isGetOrSetAccessorDeclaration,
|
|
182729
182883
|
isGlobalDeclaration,
|
|
182730
182884
|
isGlobalScopeAugmentation,
|
|
182885
|
+
isGrammarError,
|
|
182731
182886
|
isHeritageClause,
|
|
182732
182887
|
isHoistedFunction,
|
|
182733
182888
|
isHoistedVariableStatement,
|