typescript 5.0.0-dev.20230217 → 5.0.0-dev.20230219
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 +134 -66
- package/lib/tsserver.js +156 -73
- package/lib/tsserverlibrary.js +156 -73
- package/lib/typescript.js +156 -73
- package/lib/typingsInstaller.js +40 -44
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -2288,7 +2288,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2288
2288
|
|
|
2289
2289
|
// src/compiler/corePublic.ts
|
|
2290
2290
|
var versionMajorMinor = "5.0";
|
|
2291
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2291
|
+
var version = `${versionMajorMinor}.0-dev.20230219`;
|
|
2292
2292
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2293
2293
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2294
2294
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -11952,18 +11952,18 @@ function isIdentifierText(name, languageVersion, identifierVariant) {
|
|
|
11952
11952
|
return true;
|
|
11953
11953
|
}
|
|
11954
11954
|
function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Standard */, textInitial, onError, start2, length2) {
|
|
11955
|
-
|
|
11956
|
-
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
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;
|
|
11965
11965
|
setText(text, start2, length2);
|
|
11966
|
-
|
|
11966
|
+
var scanner2 = {
|
|
11967
11967
|
getStartPos: () => startPos,
|
|
11968
11968
|
getTextPos: () => pos,
|
|
11969
11969
|
getToken: () => token,
|
|
@@ -30354,22 +30354,22 @@ function parseJSDocTypeExpressionForTests(content, start2, length2) {
|
|
|
30354
30354
|
}
|
|
30355
30355
|
var Parser;
|
|
30356
30356
|
((Parser2) => {
|
|
30357
|
-
|
|
30357
|
+
var scanner2 = createScanner(
|
|
30358
30358
|
99 /* Latest */,
|
|
30359
30359
|
/*skipTrivia*/
|
|
30360
30360
|
true
|
|
30361
30361
|
);
|
|
30362
|
-
|
|
30363
|
-
|
|
30364
|
-
|
|
30365
|
-
|
|
30366
|
-
|
|
30367
|
-
|
|
30362
|
+
var disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
|
|
30363
|
+
var NodeConstructor2;
|
|
30364
|
+
var TokenConstructor2;
|
|
30365
|
+
var IdentifierConstructor2;
|
|
30366
|
+
var PrivateIdentifierConstructor2;
|
|
30367
|
+
var SourceFileConstructor2;
|
|
30368
30368
|
function countNode(node) {
|
|
30369
30369
|
nodeCount++;
|
|
30370
30370
|
return node;
|
|
30371
30371
|
}
|
|
30372
|
-
|
|
30372
|
+
var baseNodeFactory = {
|
|
30373
30373
|
createBaseSourceFileNode: (kind) => countNode(new SourceFileConstructor2(
|
|
30374
30374
|
kind,
|
|
30375
30375
|
/*pos*/
|
|
@@ -30406,25 +30406,25 @@ var Parser;
|
|
|
30406
30406
|
0
|
|
30407
30407
|
))
|
|
30408
30408
|
};
|
|
30409
|
-
|
|
30410
|
-
|
|
30411
|
-
|
|
30412
|
-
|
|
30413
|
-
|
|
30414
|
-
|
|
30415
|
-
|
|
30416
|
-
|
|
30417
|
-
|
|
30418
|
-
|
|
30419
|
-
|
|
30420
|
-
|
|
30421
|
-
|
|
30422
|
-
|
|
30423
|
-
|
|
30424
|
-
|
|
30425
|
-
|
|
30426
|
-
|
|
30427
|
-
|
|
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;
|
|
30428
30428
|
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride) {
|
|
30429
30429
|
var _a2;
|
|
30430
30430
|
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
|
|
@@ -33931,13 +33931,9 @@ var Parser;
|
|
|
33931
33931
|
function parseJsxClosingFragment(inExpressionContext) {
|
|
33932
33932
|
const pos = getNodePos();
|
|
33933
33933
|
parseExpected(30 /* LessThanSlashToken */);
|
|
33934
|
-
if (tokenIsIdentifierOrKeyword(token())) {
|
|
33935
|
-
parseErrorAtRange(parseJsxElementName(), Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
|
|
33936
|
-
}
|
|
33937
33934
|
if (parseExpected(
|
|
33938
33935
|
31 /* GreaterThanToken */,
|
|
33939
|
-
|
|
33940
|
-
void 0,
|
|
33936
|
+
Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment,
|
|
33941
33937
|
/*shouldAdvance*/
|
|
33942
33938
|
false
|
|
33943
33939
|
)) {
|
|
@@ -51899,7 +51895,7 @@ function createTypeChecker(host) {
|
|
|
51899
51895
|
return result;
|
|
51900
51896
|
}
|
|
51901
51897
|
function createAnonymousTypeNode(type2) {
|
|
51902
|
-
var _a3;
|
|
51898
|
+
var _a3, _b2;
|
|
51903
51899
|
const typeId = type2.id;
|
|
51904
51900
|
const symbol = type2.symbol;
|
|
51905
51901
|
if (symbol) {
|
|
@@ -51925,6 +51921,20 @@ function createTypeChecker(host) {
|
|
|
51925
51921
|
return visitAndTransformType(type2, createTypeNodeFromObjectType);
|
|
51926
51922
|
}
|
|
51927
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
|
+
}
|
|
51928
51938
|
return createTypeNodeFromObjectType(type2);
|
|
51929
51939
|
}
|
|
51930
51940
|
function shouldWriteTypeOfFunctionSymbol() {
|
|
@@ -52433,7 +52443,7 @@ function createTypeChecker(host) {
|
|
|
52433
52443
|
);
|
|
52434
52444
|
}
|
|
52435
52445
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
52436
|
-
var _a2, _b, _c, _d;
|
|
52446
|
+
var _a2, _b, _c, _d, _e;
|
|
52437
52447
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
52438
52448
|
if (suppressAny)
|
|
52439
52449
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
@@ -52450,6 +52460,39 @@ function createTypeChecker(host) {
|
|
|
52450
52460
|
/*skipUnionExpanding*/
|
|
52451
52461
|
true
|
|
52452
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
|
+
}
|
|
52453
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));
|
|
52454
52497
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
52455
52498
|
if (thisParameter) {
|
|
@@ -52475,11 +52518,11 @@ function createTypeChecker(host) {
|
|
|
52475
52518
|
const flags = modifiersToFlags(modifiers);
|
|
52476
52519
|
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
|
|
52477
52520
|
}
|
|
52478
|
-
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(
|
|
52479
52522
|
modifiers,
|
|
52480
52523
|
/*asteriskToken*/
|
|
52481
52524
|
void 0,
|
|
52482
|
-
(
|
|
52525
|
+
(_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
|
|
52483
52526
|
/*questionToken*/
|
|
52484
52527
|
void 0,
|
|
52485
52528
|
typeParameters,
|
|
@@ -52494,14 +52537,14 @@ function createTypeChecker(host) {
|
|
|
52494
52537
|
void 0
|
|
52495
52538
|
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
|
|
52496
52539
|
modifiers,
|
|
52497
|
-
(
|
|
52540
|
+
(_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
|
|
52498
52541
|
parameters,
|
|
52499
52542
|
returnTypeNode,
|
|
52500
52543
|
/*body*/
|
|
52501
52544
|
void 0
|
|
52502
52545
|
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
|
|
52503
52546
|
modifiers,
|
|
52504
|
-
(
|
|
52547
|
+
(_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
|
|
52505
52548
|
parameters,
|
|
52506
52549
|
/*body*/
|
|
52507
52550
|
void 0
|
|
@@ -52536,6 +52579,7 @@ function createTypeChecker(host) {
|
|
|
52536
52579
|
if (typeArguments) {
|
|
52537
52580
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
52538
52581
|
}
|
|
52582
|
+
cleanup == null ? void 0 : cleanup();
|
|
52539
52583
|
return node;
|
|
52540
52584
|
}
|
|
52541
52585
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -53150,9 +53194,12 @@ function createTypeChecker(host) {
|
|
|
53150
53194
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
53151
53195
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
53152
53196
|
}
|
|
53197
|
+
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
53198
|
+
return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
|
|
53199
|
+
}
|
|
53153
53200
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
53154
53201
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
53155
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
53202
|
+
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
53156
53203
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
53157
53204
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
53158
53205
|
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
@@ -53184,7 +53231,8 @@ function createTypeChecker(host) {
|
|
|
53184
53231
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
53185
53232
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
53186
53233
|
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
|
53187
|
-
|
|
53234
|
+
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
53235
|
+
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
53188
53236
|
const annotated = getTypeFromTypeNode(annotation);
|
|
53189
53237
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
53190
53238
|
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
|
@@ -66486,7 +66534,7 @@ function createTypeChecker(host) {
|
|
|
66486
66534
|
const restType = getRestTypeOfTupleType(type);
|
|
66487
66535
|
return restType && createArrayType(restType);
|
|
66488
66536
|
}
|
|
66489
|
-
function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
|
|
66537
|
+
function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
|
|
66490
66538
|
const length2 = getTypeReferenceArity(type) - endSkipCount;
|
|
66491
66539
|
if (index < length2) {
|
|
66492
66540
|
const typeArguments = getTypeArguments(type);
|
|
@@ -66495,7 +66543,7 @@ function createTypeChecker(host) {
|
|
|
66495
66543
|
const t = typeArguments[i];
|
|
66496
66544
|
elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
|
|
66497
66545
|
}
|
|
66498
|
-
return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
|
|
66546
|
+
return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
|
|
66499
66547
|
}
|
|
66500
66548
|
return void 0;
|
|
66501
66549
|
}
|
|
@@ -71082,9 +71130,18 @@ function createTypeChecker(host) {
|
|
|
71082
71130
|
if (prop) {
|
|
71083
71131
|
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
|
|
71084
71132
|
}
|
|
71085
|
-
if (isTupleType(t)) {
|
|
71086
|
-
const restType =
|
|
71087
|
-
|
|
71133
|
+
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
71134
|
+
const restType = getElementTypeOfSliceOfTupleType(
|
|
71135
|
+
t,
|
|
71136
|
+
t.target.fixedLength,
|
|
71137
|
+
/*endSkipCount*/
|
|
71138
|
+
0,
|
|
71139
|
+
/*writing*/
|
|
71140
|
+
false,
|
|
71141
|
+
/*noReductions*/
|
|
71142
|
+
true
|
|
71143
|
+
);
|
|
71144
|
+
if (restType) {
|
|
71088
71145
|
return restType;
|
|
71089
71146
|
}
|
|
71090
71147
|
}
|
|
@@ -71131,9 +71188,18 @@ function createTypeChecker(host) {
|
|
|
71131
71188
|
return void 0;
|
|
71132
71189
|
}
|
|
71133
71190
|
function getContextualTypeForElementExpression(arrayContextualType, index) {
|
|
71134
|
-
return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
71191
|
+
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
71135
71192
|
arrayContextualType,
|
|
71136
|
-
(t) =>
|
|
71193
|
+
(t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
|
|
71194
|
+
t,
|
|
71195
|
+
0,
|
|
71196
|
+
/*endSkipCount*/
|
|
71197
|
+
0,
|
|
71198
|
+
/*writing*/
|
|
71199
|
+
false,
|
|
71200
|
+
/*noReductions*/
|
|
71201
|
+
true
|
|
71202
|
+
) : getIteratedTypeOrElementType(
|
|
71137
71203
|
1 /* Element */,
|
|
71138
71204
|
t,
|
|
71139
71205
|
undefinedType,
|
|
@@ -71286,6 +71352,7 @@ function createTypeChecker(host) {
|
|
|
71286
71352
|
return type;
|
|
71287
71353
|
}
|
|
71288
71354
|
function getContextualType2(node, contextFlags) {
|
|
71355
|
+
var _a2, _b;
|
|
71289
71356
|
if (node.flags & 33554432 /* InWithStatement */) {
|
|
71290
71357
|
return void 0;
|
|
71291
71358
|
}
|
|
@@ -71330,7 +71397,9 @@ function createTypeChecker(host) {
|
|
|
71330
71397
|
case 206 /* ArrayLiteralExpression */: {
|
|
71331
71398
|
const arrayLiteral = parent2;
|
|
71332
71399
|
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
|
|
71333
|
-
|
|
71400
|
+
const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
|
|
71401
|
+
const elementIndex = indexOfNode(arrayLiteral.elements, node);
|
|
71402
|
+
return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
|
|
71334
71403
|
}
|
|
71335
71404
|
case 224 /* ConditionalExpression */:
|
|
71336
71405
|
return getContextualTypeForConditionalOperand(node, contextFlags);
|
|
@@ -82429,20 +82498,19 @@ function createTypeChecker(host) {
|
|
|
82429
82498
|
}
|
|
82430
82499
|
}
|
|
82431
82500
|
}
|
|
82432
|
-
function getMemberOverrideModifierStatus(node, member) {
|
|
82501
|
+
function getMemberOverrideModifierStatus(node, member, memberSymbol) {
|
|
82433
82502
|
if (!member.name) {
|
|
82434
82503
|
return 0 /* Ok */;
|
|
82435
82504
|
}
|
|
82436
|
-
const
|
|
82437
|
-
const type = getDeclaredTypeOfSymbol(
|
|
82505
|
+
const classSymbol = getSymbolOfDeclaration(node);
|
|
82506
|
+
const type = getDeclaredTypeOfSymbol(classSymbol);
|
|
82438
82507
|
const typeWithThis = getTypeWithThisArgument(type);
|
|
82439
|
-
const staticType = getTypeOfSymbol(
|
|
82508
|
+
const staticType = getTypeOfSymbol(classSymbol);
|
|
82440
82509
|
const baseTypeNode = getEffectiveBaseTypeNode(node);
|
|
82441
82510
|
const baseTypes = baseTypeNode && getBaseTypes(type);
|
|
82442
82511
|
const baseWithThis = (baseTypes == null ? void 0 : baseTypes.length) ? getTypeWithThisArgument(first(baseTypes), type.thisType) : void 0;
|
|
82443
82512
|
const baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
82444
82513
|
const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member, 16384 /* Override */);
|
|
82445
|
-
const memberName = unescapeLeadingUnderscores(getTextOfPropertyName(member.name));
|
|
82446
82514
|
return checkMemberForOverrideModifier(
|
|
82447
82515
|
node,
|
|
82448
82516
|
staticType,
|
|
@@ -82455,7 +82523,7 @@ function createTypeChecker(host) {
|
|
|
82455
82523
|
isStatic(member),
|
|
82456
82524
|
/* memberIsParameterProperty */
|
|
82457
82525
|
false,
|
|
82458
|
-
|
|
82526
|
+
symbolName(memberSymbol)
|
|
82459
82527
|
);
|
|
82460
82528
|
}
|
|
82461
82529
|
function getTargetSymbol(s) {
|
|
@@ -148242,6 +148310,7 @@ var SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
|
|
148242
148310
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["TypeOnlyAlias"] = 64] = "TypeOnlyAlias";
|
|
148243
148311
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["ObjectLiteralMethod"] = 128] = "ObjectLiteralMethod";
|
|
148244
148312
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["Ignore"] = 256] = "Ignore";
|
|
148313
|
+
SymbolOriginInfoKind2[SymbolOriginInfoKind2["ComputedPropertyName"] = 512] = "ComputedPropertyName";
|
|
148245
148314
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberNoExport"] = 2 /* SymbolMember */] = "SymbolMemberNoExport";
|
|
148246
148315
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberExport"] = 6] = "SymbolMemberExport";
|
|
148247
148316
|
return SymbolOriginInfoKind2;
|
|
@@ -148259,7 +148328,7 @@ function originIsResolvedExport(origin) {
|
|
|
148259
148328
|
return !!(origin && origin.kind === 32 /* ResolvedExport */);
|
|
148260
148329
|
}
|
|
148261
148330
|
function originIncludesSymbolName(origin) {
|
|
148262
|
-
return originIsExport(origin) || originIsResolvedExport(origin);
|
|
148331
|
+
return originIsExport(origin) || originIsResolvedExport(origin) || originIsComputedPropertyName(origin);
|
|
148263
148332
|
}
|
|
148264
148333
|
function originIsPackageJsonImport(origin) {
|
|
148265
148334
|
return (originIsExport(origin) || originIsResolvedExport(origin)) && !!origin.isFromPackageJson;
|
|
@@ -148279,6 +148348,9 @@ function originIsObjectLiteralMethod(origin) {
|
|
|
148279
148348
|
function originIsIgnore(origin) {
|
|
148280
148349
|
return !!(origin && origin.kind & 256 /* Ignore */);
|
|
148281
148350
|
}
|
|
148351
|
+
function originIsComputedPropertyName(origin) {
|
|
148352
|
+
return !!(origin && origin.kind & 512 /* ComputedPropertyName */);
|
|
148353
|
+
}
|
|
148282
148354
|
function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
|
|
148283
148355
|
var _a2, _b, _c;
|
|
148284
148356
|
const start2 = timestamp();
|
|
@@ -149005,7 +149077,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
149005
149077
|
if (isAbstract) {
|
|
149006
149078
|
requiredModifiers |= 256 /* Abstract */;
|
|
149007
149079
|
}
|
|
149008
|
-
if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
|
|
149080
|
+
if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node, symbol) === 1 /* NeedsOverride */) {
|
|
149009
149081
|
requiredModifiers |= 16384 /* Override */;
|
|
149010
149082
|
}
|
|
149011
149083
|
if (!completionNodes.length) {
|
|
@@ -149599,7 +149671,8 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
|
|
|
149599
149671
|
case "symbol": {
|
|
149600
149672
|
const { symbol, location, contextToken: contextToken2, origin, previousToken: previousToken2 } = symbolCompletion;
|
|
149601
149673
|
const { codeActions, sourceDisplay } = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken2, formatContext, preferences, data, source, cancellationToken);
|
|
149602
|
-
|
|
149674
|
+
const symbolName2 = originIsComputedPropertyName(origin) ? origin.symbolName : symbol.name;
|
|
149675
|
+
return createCompletionDetailsForSymbol(symbol, symbolName2, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay);
|
|
149603
149676
|
}
|
|
149604
149677
|
case "literal": {
|
|
149605
149678
|
const { literal } = symbolCompletion;
|
|
@@ -149650,12 +149723,12 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
|
|
|
149650
149723
|
function createSimpleDetails(name, kind, kind2) {
|
|
149651
149724
|
return createCompletionDetails(name, "" /* none */, kind, [displayPart(name, kind2)]);
|
|
149652
149725
|
}
|
|
149653
|
-
function createCompletionDetailsForSymbol(symbol, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) {
|
|
149726
|
+
function createCompletionDetailsForSymbol(symbol, name, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) {
|
|
149654
149727
|
const { displayParts, documentation, symbolKind, tags } = checker.runWithCancellationToken(
|
|
149655
149728
|
cancellationToken,
|
|
149656
149729
|
(checker2) => ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(checker2, symbol, sourceFile, location, location, 7 /* All */)
|
|
149657
149730
|
);
|
|
149658
|
-
return createCompletionDetails(
|
|
149731
|
+
return createCompletionDetails(name, ts_SymbolDisplay_exports.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay);
|
|
149659
149732
|
}
|
|
149660
149733
|
function createCompletionDetails(name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source) {
|
|
149661
149734
|
return { name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source, sourceDisplay: source };
|
|
@@ -150762,6 +150835,16 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
150762
150835
|
return classElementModifierFlags & 32 /* Static */ ? (type == null ? void 0 : type.symbol) && typeChecker.getPropertiesOfType(typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl)) : type && typeChecker.getPropertiesOfType(type);
|
|
150763
150836
|
});
|
|
150764
150837
|
symbols = concatenate(symbols, filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags));
|
|
150838
|
+
forEach(symbols, (symbol, index) => {
|
|
150839
|
+
const declaration = symbol == null ? void 0 : symbol.valueDeclaration;
|
|
150840
|
+
if (declaration && isClassElement(declaration) && declaration.name && isComputedPropertyName(declaration.name)) {
|
|
150841
|
+
const origin = {
|
|
150842
|
+
kind: 512 /* ComputedPropertyName */,
|
|
150843
|
+
symbolName: typeChecker.symbolToString(symbol)
|
|
150844
|
+
};
|
|
150845
|
+
symbolToOriginInfoMap[index] = origin;
|
|
150846
|
+
}
|
|
150847
|
+
});
|
|
150765
150848
|
}
|
|
150766
150849
|
return 1 /* Success */;
|
|
150767
150850
|
}
|
|
@@ -151146,7 +151229,7 @@ function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, js
|
|
|
151146
151229
|
}
|
|
151147
151230
|
switch (kind) {
|
|
151148
151231
|
case 3 /* MemberLike */:
|
|
151149
|
-
return void 0;
|
|
151232
|
+
return originIsComputedPropertyName(origin) ? { name: origin.symbolName, needsConvertPropertyAccess: false } : void 0;
|
|
151150
151233
|
case 0 /* ObjectPropertyDeclaration */:
|
|
151151
151234
|
return { name: JSON.stringify(name), needsConvertPropertyAccess: false };
|
|
151152
151235
|
case 2 /* PropertyAccess */:
|
|
@@ -151738,7 +151821,7 @@ function stringLiteralCompletionDetails(name, location, completion, sourceFile,
|
|
|
151738
151821
|
}
|
|
151739
151822
|
case 1 /* Properties */: {
|
|
151740
151823
|
const match = find(completion.symbols, (s) => s.name === name);
|
|
151741
|
-
return match && createCompletionDetailsForSymbol(match, checker, sourceFile, location, cancellationToken);
|
|
151824
|
+
return match && createCompletionDetailsForSymbol(match, match.name, checker, sourceFile, location, cancellationToken);
|
|
151742
151825
|
}
|
|
151743
151826
|
case 2 /* Types */:
|
|
151744
151827
|
return find(completion.types, (t) => t.value === name) ? createCompletionDetails(name, "" /* none */, "string" /* string */, [textPart(name)]) : void 0;
|