@typescript-deploys/pr-build 5.0.0-pr-50431-13 → 5.0.0-pr-52836-9
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 +127 -112
- package/lib/tsserver.js +149 -128
- package/lib/tsserverlibrary.js +149 -126
- package/lib/typescript.js +149 -124
- package/lib/typingsInstaller.js +40 -44
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -1797,8 +1797,6 @@ __export(server_exports, {
|
|
|
1797
1797
|
isWithStatement: () => isWithStatement,
|
|
1798
1798
|
isWriteAccess: () => isWriteAccess,
|
|
1799
1799
|
isWriteOnlyAccess: () => isWriteOnlyAccess,
|
|
1800
|
-
isWriteOnlyUsage: () => isWriteOnlyUsage,
|
|
1801
|
-
isWriteUsage: () => isWriteUsage,
|
|
1802
1800
|
isYieldExpression: () => isYieldExpression,
|
|
1803
1801
|
jsxModeNeedsExplicitImport: () => jsxModeNeedsExplicitImport,
|
|
1804
1802
|
keywordPart: () => keywordPart,
|
|
@@ -2290,7 +2288,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2290
2288
|
|
|
2291
2289
|
// src/compiler/corePublic.ts
|
|
2292
2290
|
var versionMajorMinor = "5.0";
|
|
2293
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2291
|
+
var version = `${versionMajorMinor}.0-insiders.20230218`;
|
|
2294
2292
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2295
2293
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2296
2294
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -11954,18 +11952,18 @@ function isIdentifierText(name, languageVersion, identifierVariant) {
|
|
|
11954
11952
|
return true;
|
|
11955
11953
|
}
|
|
11956
11954
|
function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Standard */, textInitial, onError, start2, length2) {
|
|
11957
|
-
|
|
11958
|
-
|
|
11959
|
-
|
|
11960
|
-
|
|
11961
|
-
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
|
|
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;
|
|
11967
11965
|
setText(text, start2, length2);
|
|
11968
|
-
|
|
11966
|
+
var scanner2 = {
|
|
11969
11967
|
getStartPos: () => startPos,
|
|
11970
11968
|
getTextPos: () => pos,
|
|
11971
11969
|
getToken: () => token,
|
|
@@ -19654,39 +19652,20 @@ function isWriteOnlyAccess(node) {
|
|
|
19654
19652
|
function isWriteAccess(node) {
|
|
19655
19653
|
return accessKind(node) !== 0 /* Read */;
|
|
19656
19654
|
}
|
|
19657
|
-
function isWriteOnlyUsage(node) {
|
|
19658
|
-
return accessKindForUsageChecks(node) === 1 /* Write */;
|
|
19659
|
-
}
|
|
19660
|
-
function isWriteUsage(node) {
|
|
19661
|
-
return accessKindForUsageChecks(node) !== 0 /* Read */;
|
|
19662
|
-
}
|
|
19663
|
-
function accessKindForUsageChecks(node) {
|
|
19664
|
-
const kind = accessKind(node);
|
|
19665
|
-
const { parent: parent2 } = node;
|
|
19666
|
-
switch (parent2 == null ? void 0 : parent2.kind) {
|
|
19667
|
-
case 222 /* PostfixUnaryExpression */:
|
|
19668
|
-
case 221 /* PrefixUnaryExpression */:
|
|
19669
|
-
case 223 /* BinaryExpression */:
|
|
19670
|
-
return kind === 2 /* ReadWrite */ ? writeOrReadWrite() : kind;
|
|
19671
|
-
default:
|
|
19672
|
-
return kind;
|
|
19673
|
-
}
|
|
19674
|
-
function writeOrReadWrite() {
|
|
19675
|
-
return parent2.parent && walkUpParenthesizedExpressions(parent2.parent).kind === 241 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
|
|
19676
|
-
}
|
|
19677
|
-
}
|
|
19678
19655
|
function accessKind(node) {
|
|
19679
19656
|
const { parent: parent2 } = node;
|
|
19680
|
-
|
|
19657
|
+
if (!parent2)
|
|
19658
|
+
return 0 /* Read */;
|
|
19659
|
+
switch (parent2.kind) {
|
|
19681
19660
|
case 214 /* ParenthesizedExpression */:
|
|
19682
19661
|
return accessKind(parent2);
|
|
19683
19662
|
case 222 /* PostfixUnaryExpression */:
|
|
19684
19663
|
case 221 /* PrefixUnaryExpression */:
|
|
19685
19664
|
const { operator } = parent2;
|
|
19686
|
-
return operator === 45 /* PlusPlusToken */ || operator === 46 /* MinusMinusToken */ ?
|
|
19665
|
+
return operator === 45 /* PlusPlusToken */ || operator === 46 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */;
|
|
19687
19666
|
case 223 /* BinaryExpression */:
|
|
19688
19667
|
const { left, operatorToken } = parent2;
|
|
19689
|
-
return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* EqualsToken */ ? 1 /* Write */ :
|
|
19668
|
+
return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite() : 0 /* Read */;
|
|
19690
19669
|
case 208 /* PropertyAccessExpression */:
|
|
19691
19670
|
return parent2.name !== node ? 0 /* Read */ : accessKind(parent2);
|
|
19692
19671
|
case 299 /* PropertyAssignment */: {
|
|
@@ -19700,6 +19679,9 @@ function accessKind(node) {
|
|
|
19700
19679
|
default:
|
|
19701
19680
|
return 0 /* Read */;
|
|
19702
19681
|
}
|
|
19682
|
+
function writeOrReadWrite() {
|
|
19683
|
+
return parent2.parent && walkUpParenthesizedExpressions(parent2.parent).kind === 241 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
|
|
19684
|
+
}
|
|
19703
19685
|
}
|
|
19704
19686
|
function reverseAccessKind(a) {
|
|
19705
19687
|
switch (a) {
|
|
@@ -30372,22 +30354,22 @@ function parseJSDocTypeExpressionForTests(content, start2, length2) {
|
|
|
30372
30354
|
}
|
|
30373
30355
|
var Parser;
|
|
30374
30356
|
((Parser2) => {
|
|
30375
|
-
|
|
30357
|
+
var scanner2 = createScanner(
|
|
30376
30358
|
99 /* Latest */,
|
|
30377
30359
|
/*skipTrivia*/
|
|
30378
30360
|
true
|
|
30379
30361
|
);
|
|
30380
|
-
|
|
30381
|
-
|
|
30382
|
-
|
|
30383
|
-
|
|
30384
|
-
|
|
30385
|
-
|
|
30362
|
+
var disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
|
|
30363
|
+
var NodeConstructor2;
|
|
30364
|
+
var TokenConstructor2;
|
|
30365
|
+
var IdentifierConstructor2;
|
|
30366
|
+
var PrivateIdentifierConstructor2;
|
|
30367
|
+
var SourceFileConstructor2;
|
|
30386
30368
|
function countNode(node) {
|
|
30387
30369
|
nodeCount++;
|
|
30388
30370
|
return node;
|
|
30389
30371
|
}
|
|
30390
|
-
|
|
30372
|
+
var baseNodeFactory = {
|
|
30391
30373
|
createBaseSourceFileNode: (kind) => countNode(new SourceFileConstructor2(
|
|
30392
30374
|
kind,
|
|
30393
30375
|
/*pos*/
|
|
@@ -30424,25 +30406,25 @@ var Parser;
|
|
|
30424
30406
|
0
|
|
30425
30407
|
))
|
|
30426
30408
|
};
|
|
30427
|
-
|
|
30428
|
-
|
|
30429
|
-
|
|
30430
|
-
|
|
30431
|
-
|
|
30432
|
-
|
|
30433
|
-
|
|
30434
|
-
|
|
30435
|
-
|
|
30436
|
-
|
|
30437
|
-
|
|
30438
|
-
|
|
30439
|
-
|
|
30440
|
-
|
|
30441
|
-
|
|
30442
|
-
|
|
30443
|
-
|
|
30444
|
-
|
|
30445
|
-
|
|
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;
|
|
30446
30428
|
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride) {
|
|
30447
30429
|
var _a2;
|
|
30448
30430
|
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
|
|
@@ -33949,13 +33931,9 @@ var Parser;
|
|
|
33949
33931
|
function parseJsxClosingFragment(inExpressionContext) {
|
|
33950
33932
|
const pos = getNodePos();
|
|
33951
33933
|
parseExpected(30 /* LessThanSlashToken */);
|
|
33952
|
-
if (tokenIsIdentifierOrKeyword(token())) {
|
|
33953
|
-
parseErrorAtRange(parseJsxElementName(), Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
|
|
33954
|
-
}
|
|
33955
33934
|
if (parseExpected(
|
|
33956
33935
|
31 /* GreaterThanToken */,
|
|
33957
|
-
|
|
33958
|
-
void 0,
|
|
33936
|
+
Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment,
|
|
33959
33937
|
/*shouldAdvance*/
|
|
33960
33938
|
false
|
|
33961
33939
|
)) {
|
|
@@ -51917,7 +51895,7 @@ function createTypeChecker(host) {
|
|
|
51917
51895
|
return result;
|
|
51918
51896
|
}
|
|
51919
51897
|
function createAnonymousTypeNode(type2) {
|
|
51920
|
-
var _a3;
|
|
51898
|
+
var _a3, _b2;
|
|
51921
51899
|
const typeId = type2.id;
|
|
51922
51900
|
const symbol = type2.symbol;
|
|
51923
51901
|
if (symbol) {
|
|
@@ -51943,6 +51921,20 @@ function createTypeChecker(host) {
|
|
|
51943
51921
|
return visitAndTransformType(type2, createTypeNodeFromObjectType);
|
|
51944
51922
|
}
|
|
51945
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
|
+
}
|
|
51946
51938
|
return createTypeNodeFromObjectType(type2);
|
|
51947
51939
|
}
|
|
51948
51940
|
function shouldWriteTypeOfFunctionSymbol() {
|
|
@@ -52451,7 +52443,7 @@ function createTypeChecker(host) {
|
|
|
52451
52443
|
);
|
|
52452
52444
|
}
|
|
52453
52445
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
52454
|
-
var _a2, _b, _c, _d;
|
|
52446
|
+
var _a2, _b, _c, _d, _e;
|
|
52455
52447
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
52456
52448
|
if (suppressAny)
|
|
52457
52449
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
@@ -52468,6 +52460,39 @@ function createTypeChecker(host) {
|
|
|
52468
52460
|
/*skipUnionExpanding*/
|
|
52469
52461
|
true
|
|
52470
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
|
+
}
|
|
52471
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));
|
|
52472
52497
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
52473
52498
|
if (thisParameter) {
|
|
@@ -52493,11 +52518,11 @@ function createTypeChecker(host) {
|
|
|
52493
52518
|
const flags = modifiersToFlags(modifiers);
|
|
52494
52519
|
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
|
|
52495
52520
|
}
|
|
52496
|
-
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(
|
|
52497
52522
|
modifiers,
|
|
52498
52523
|
/*asteriskToken*/
|
|
52499
52524
|
void 0,
|
|
52500
|
-
(
|
|
52525
|
+
(_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
|
|
52501
52526
|
/*questionToken*/
|
|
52502
52527
|
void 0,
|
|
52503
52528
|
typeParameters,
|
|
@@ -52512,14 +52537,14 @@ function createTypeChecker(host) {
|
|
|
52512
52537
|
void 0
|
|
52513
52538
|
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
|
|
52514
52539
|
modifiers,
|
|
52515
|
-
(
|
|
52540
|
+
(_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
|
|
52516
52541
|
parameters,
|
|
52517
52542
|
returnTypeNode,
|
|
52518
52543
|
/*body*/
|
|
52519
52544
|
void 0
|
|
52520
52545
|
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
|
|
52521
52546
|
modifiers,
|
|
52522
|
-
(
|
|
52547
|
+
(_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
|
|
52523
52548
|
parameters,
|
|
52524
52549
|
/*body*/
|
|
52525
52550
|
void 0
|
|
@@ -52554,6 +52579,7 @@ function createTypeChecker(host) {
|
|
|
52554
52579
|
if (typeArguments) {
|
|
52555
52580
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
52556
52581
|
}
|
|
52582
|
+
cleanup == null ? void 0 : cleanup();
|
|
52557
52583
|
return node;
|
|
52558
52584
|
}
|
|
52559
52585
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -53168,9 +53194,12 @@ function createTypeChecker(host) {
|
|
|
53168
53194
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
53169
53195
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
53170
53196
|
}
|
|
53197
|
+
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
53198
|
+
return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
|
|
53199
|
+
}
|
|
53171
53200
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
53172
53201
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
53173
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
53202
|
+
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
53174
53203
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
53175
53204
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
53176
53205
|
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
@@ -53202,7 +53231,8 @@ function createTypeChecker(host) {
|
|
|
53202
53231
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
53203
53232
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
53204
53233
|
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
|
53205
|
-
|
|
53234
|
+
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
53235
|
+
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
53206
53236
|
const annotated = getTypeFromTypeNode(annotation);
|
|
53207
53237
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
53208
53238
|
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
|
@@ -60964,31 +60994,21 @@ function createTypeChecker(host) {
|
|
|
60964
60994
|
}
|
|
60965
60995
|
return type;
|
|
60966
60996
|
function addSpans(texts2, types2) {
|
|
60967
|
-
const isTextsArray = isArray(texts2);
|
|
60968
60997
|
for (let i = 0; i < types2.length; i++) {
|
|
60969
60998
|
const t = types2[i];
|
|
60970
|
-
const addText = isTextsArray ? texts2[i + 1] : texts2;
|
|
60971
60999
|
if (t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) {
|
|
60972
61000
|
text += getTemplateStringForType(t) || "";
|
|
60973
|
-
text +=
|
|
60974
|
-
if (!isTextsArray)
|
|
60975
|
-
return true;
|
|
61001
|
+
text += texts2[i + 1];
|
|
60976
61002
|
} else if (t.flags & 134217728 /* TemplateLiteral */) {
|
|
60977
61003
|
text += t.texts[0];
|
|
60978
61004
|
if (!addSpans(t.texts, t.types))
|
|
60979
61005
|
return false;
|
|
60980
|
-
text +=
|
|
60981
|
-
|
|
60982
|
-
return true;
|
|
60983
|
-
} else if (isGenericIndexType(t) || isPatternLiteralPlaceholderType(t)) {
|
|
61006
|
+
text += texts2[i + 1];
|
|
61007
|
+
} else if (isGenericIndexType(t) || isPatternLiteralPlaceholderType(t) || t.flags & 2097152 /* Intersection */) {
|
|
60984
61008
|
newTypes.push(t);
|
|
60985
61009
|
newTexts.push(text);
|
|
60986
|
-
text =
|
|
60987
|
-
} else
|
|
60988
|
-
const added = addSpans(texts2[i + 1], t.types);
|
|
60989
|
-
if (!added)
|
|
60990
|
-
return false;
|
|
60991
|
-
} else if (isTextsArray) {
|
|
61010
|
+
text = texts2[i + 1];
|
|
61011
|
+
} else {
|
|
60992
61012
|
return false;
|
|
60993
61013
|
}
|
|
60994
61014
|
}
|
|
@@ -67980,7 +68000,7 @@ function createTypeChecker(host) {
|
|
|
67980
68000
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
|
67981
68001
|
getCannotFindNameDiagnosticForName(node),
|
|
67982
68002
|
node,
|
|
67983
|
-
!
|
|
68003
|
+
!isWriteOnlyAccess(node),
|
|
67984
68004
|
/*excludeGlobals*/
|
|
67985
68005
|
false
|
|
67986
68006
|
) || unknownSymbol;
|
|
@@ -72798,8 +72818,8 @@ function createTypeChecker(host) {
|
|
|
72798
72818
|
}
|
|
72799
72819
|
return nonNullType;
|
|
72800
72820
|
}
|
|
72801
|
-
function checkPropertyAccessExpression(node, checkMode
|
|
72802
|
-
return node.flags & 32 /* OptionalChain */ ? checkPropertyAccessChain(node, checkMode) : checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode
|
|
72821
|
+
function checkPropertyAccessExpression(node, checkMode) {
|
|
72822
|
+
return node.flags & 32 /* OptionalChain */ ? checkPropertyAccessChain(node, checkMode) : checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode);
|
|
72803
72823
|
}
|
|
72804
72824
|
function checkPropertyAccessChain(node, checkMode) {
|
|
72805
72825
|
const leftType = checkExpression(node.expression);
|
|
@@ -72930,7 +72950,7 @@ function createTypeChecker(host) {
|
|
|
72930
72950
|
false
|
|
72931
72951
|
) === getDeclaringConstructor(prop);
|
|
72932
72952
|
}
|
|
72933
|
-
function checkPropertyAccessExpressionOrQualifiedName(node, left, leftType, right, checkMode
|
|
72953
|
+
function checkPropertyAccessExpressionOrQualifiedName(node, left, leftType, right, checkMode) {
|
|
72934
72954
|
const parentSymbol = getNodeLinks(left).resolvedSymbol;
|
|
72935
72955
|
const assignmentKind = getAssignmentTargetKind(node);
|
|
72936
72956
|
const apparentType = getApparentType(assignmentKind !== 0 /* None */ || isMethodAccessForCall(node) ? getWidenedType(leftType) : leftType);
|
|
@@ -73029,12 +73049,13 @@ function createTypeChecker(host) {
|
|
|
73029
73049
|
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
|
|
73030
73050
|
markPropertyAsReferenced(prop, node, isSelfTypeAccess(left, parentSymbol));
|
|
73031
73051
|
getNodeLinks(node).resolvedSymbol = prop;
|
|
73032
|
-
|
|
73052
|
+
const writing = isWriteAccess(node);
|
|
73053
|
+
checkPropertyAccessibility(node, left.kind === 106 /* SuperKeyword */, writing, apparentType, prop);
|
|
73033
73054
|
if (isAssignmentToReadonlyEntity(node, prop, assignmentKind)) {
|
|
73034
73055
|
error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right));
|
|
73035
73056
|
return errorType;
|
|
73036
73057
|
}
|
|
73037
|
-
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType :
|
|
73058
|
+
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writing ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
|
|
73038
73059
|
}
|
|
73039
73060
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
73040
73061
|
}
|
|
@@ -73350,7 +73371,7 @@ function createTypeChecker(host) {
|
|
|
73350
73371
|
if (!hasPrivateModifier && !hasPrivateIdentifier) {
|
|
73351
73372
|
return;
|
|
73352
73373
|
}
|
|
73353
|
-
if (nodeForCheckWriteOnly &&
|
|
73374
|
+
if (nodeForCheckWriteOnly && isWriteOnlyAccess(nodeForCheckWriteOnly) && !(prop.flags & 65536 /* SetAccessor */)) {
|
|
73354
73375
|
return;
|
|
73355
73376
|
}
|
|
73356
73377
|
if (isSelfTypeAccess2) {
|
|
@@ -77664,16 +77685,6 @@ function createTypeChecker(host) {
|
|
|
77664
77685
|
addLazyDiagnostic(checkAssignmentOperatorWorker);
|
|
77665
77686
|
}
|
|
77666
77687
|
function checkAssignmentOperatorWorker() {
|
|
77667
|
-
let assigneeType = leftType;
|
|
77668
|
-
if (isCompoundAssignment(operatorToken.kind) && left.kind === 208 /* PropertyAccessExpression */) {
|
|
77669
|
-
assigneeType = checkPropertyAccessExpression(
|
|
77670
|
-
left,
|
|
77671
|
-
/*checkMode*/
|
|
77672
|
-
void 0,
|
|
77673
|
-
/*writeOnly*/
|
|
77674
|
-
true
|
|
77675
|
-
);
|
|
77676
|
-
}
|
|
77677
77688
|
if (checkReferenceExpression(
|
|
77678
77689
|
left,
|
|
77679
77690
|
Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access,
|
|
@@ -77686,7 +77697,7 @@ function createTypeChecker(host) {
|
|
|
77686
77697
|
headMessage = Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target;
|
|
77687
77698
|
}
|
|
77688
77699
|
}
|
|
77689
|
-
checkTypeAssignableToAndOptionallyElaborate(valueType,
|
|
77700
|
+
checkTypeAssignableToAndOptionallyElaborate(valueType, leftType, left, right, headMessage);
|
|
77690
77701
|
}
|
|
77691
77702
|
}
|
|
77692
77703
|
}
|
|
@@ -82456,20 +82467,19 @@ function createTypeChecker(host) {
|
|
|
82456
82467
|
}
|
|
82457
82468
|
}
|
|
82458
82469
|
}
|
|
82459
|
-
function getMemberOverrideModifierStatus(node, member) {
|
|
82470
|
+
function getMemberOverrideModifierStatus(node, member, memberSymbol) {
|
|
82460
82471
|
if (!member.name) {
|
|
82461
82472
|
return 0 /* Ok */;
|
|
82462
82473
|
}
|
|
82463
|
-
const
|
|
82464
|
-
const type = getDeclaredTypeOfSymbol(
|
|
82474
|
+
const classSymbol = getSymbolOfDeclaration(node);
|
|
82475
|
+
const type = getDeclaredTypeOfSymbol(classSymbol);
|
|
82465
82476
|
const typeWithThis = getTypeWithThisArgument(type);
|
|
82466
|
-
const staticType = getTypeOfSymbol(
|
|
82477
|
+
const staticType = getTypeOfSymbol(classSymbol);
|
|
82467
82478
|
const baseTypeNode = getEffectiveBaseTypeNode(node);
|
|
82468
82479
|
const baseTypes = baseTypeNode && getBaseTypes(type);
|
|
82469
82480
|
const baseWithThis = (baseTypes == null ? void 0 : baseTypes.length) ? getTypeWithThisArgument(first(baseTypes), type.thisType) : void 0;
|
|
82470
82481
|
const baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
82471
82482
|
const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member, 16384 /* Override */);
|
|
82472
|
-
const memberName = unescapeLeadingUnderscores(getTextOfPropertyName(member.name));
|
|
82473
82483
|
return checkMemberForOverrideModifier(
|
|
82474
82484
|
node,
|
|
82475
82485
|
staticType,
|
|
@@ -82482,7 +82492,7 @@ function createTypeChecker(host) {
|
|
|
82482
82492
|
isStatic(member),
|
|
82483
82493
|
/* memberIsParameterProperty */
|
|
82484
82494
|
false,
|
|
82485
|
-
|
|
82495
|
+
symbolName(memberSymbol)
|
|
82486
82496
|
);
|
|
82487
82497
|
}
|
|
82488
82498
|
function getTargetSymbol(s) {
|
|
@@ -148269,6 +148279,7 @@ var SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
|
|
148269
148279
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["TypeOnlyAlias"] = 64] = "TypeOnlyAlias";
|
|
148270
148280
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["ObjectLiteralMethod"] = 128] = "ObjectLiteralMethod";
|
|
148271
148281
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["Ignore"] = 256] = "Ignore";
|
|
148282
|
+
SymbolOriginInfoKind2[SymbolOriginInfoKind2["ComputedPropertyName"] = 512] = "ComputedPropertyName";
|
|
148272
148283
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberNoExport"] = 2 /* SymbolMember */] = "SymbolMemberNoExport";
|
|
148273
148284
|
SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberExport"] = 6] = "SymbolMemberExport";
|
|
148274
148285
|
return SymbolOriginInfoKind2;
|
|
@@ -148286,7 +148297,7 @@ function originIsResolvedExport(origin) {
|
|
|
148286
148297
|
return !!(origin && origin.kind === 32 /* ResolvedExport */);
|
|
148287
148298
|
}
|
|
148288
148299
|
function originIncludesSymbolName(origin) {
|
|
148289
|
-
return originIsExport(origin) || originIsResolvedExport(origin);
|
|
148300
|
+
return originIsExport(origin) || originIsResolvedExport(origin) || originIsComputedPropertyName(origin);
|
|
148290
148301
|
}
|
|
148291
148302
|
function originIsPackageJsonImport(origin) {
|
|
148292
148303
|
return (originIsExport(origin) || originIsResolvedExport(origin)) && !!origin.isFromPackageJson;
|
|
@@ -148306,6 +148317,9 @@ function originIsObjectLiteralMethod(origin) {
|
|
|
148306
148317
|
function originIsIgnore(origin) {
|
|
148307
148318
|
return !!(origin && origin.kind & 256 /* Ignore */);
|
|
148308
148319
|
}
|
|
148320
|
+
function originIsComputedPropertyName(origin) {
|
|
148321
|
+
return !!(origin && origin.kind & 512 /* ComputedPropertyName */);
|
|
148322
|
+
}
|
|
148309
148323
|
function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) {
|
|
148310
148324
|
var _a2, _b, _c;
|
|
148311
148325
|
const start2 = timestamp();
|
|
@@ -149032,7 +149046,7 @@ function getEntryForMemberCompletion(host, program, options, preferences, name,
|
|
|
149032
149046
|
if (isAbstract) {
|
|
149033
149047
|
requiredModifiers |= 256 /* Abstract */;
|
|
149034
149048
|
}
|
|
149035
|
-
if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
|
|
149049
|
+
if (isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node, symbol) === 1 /* NeedsOverride */) {
|
|
149036
149050
|
requiredModifiers |= 16384 /* Override */;
|
|
149037
149051
|
}
|
|
149038
149052
|
if (!completionNodes.length) {
|
|
@@ -149626,7 +149640,8 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
|
|
|
149626
149640
|
case "symbol": {
|
|
149627
149641
|
const { symbol, location, contextToken: contextToken2, origin, previousToken: previousToken2 } = symbolCompletion;
|
|
149628
149642
|
const { codeActions, sourceDisplay } = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken2, formatContext, preferences, data, source, cancellationToken);
|
|
149629
|
-
|
|
149643
|
+
const symbolName2 = originIsComputedPropertyName(origin) ? origin.symbolName : symbol.name;
|
|
149644
|
+
return createCompletionDetailsForSymbol(symbol, symbolName2, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay);
|
|
149630
149645
|
}
|
|
149631
149646
|
case "literal": {
|
|
149632
149647
|
const { literal } = symbolCompletion;
|
|
@@ -149677,12 +149692,12 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
|
|
|
149677
149692
|
function createSimpleDetails(name, kind, kind2) {
|
|
149678
149693
|
return createCompletionDetails(name, "" /* none */, kind, [displayPart(name, kind2)]);
|
|
149679
149694
|
}
|
|
149680
|
-
function createCompletionDetailsForSymbol(symbol, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) {
|
|
149695
|
+
function createCompletionDetailsForSymbol(symbol, name, checker, sourceFile, location, cancellationToken, codeActions, sourceDisplay) {
|
|
149681
149696
|
const { displayParts, documentation, symbolKind, tags } = checker.runWithCancellationToken(
|
|
149682
149697
|
cancellationToken,
|
|
149683
149698
|
(checker2) => ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(checker2, symbol, sourceFile, location, location, 7 /* All */)
|
|
149684
149699
|
);
|
|
149685
|
-
return createCompletionDetails(
|
|
149700
|
+
return createCompletionDetails(name, ts_SymbolDisplay_exports.getSymbolModifiers(checker, symbol), symbolKind, displayParts, documentation, tags, codeActions, sourceDisplay);
|
|
149686
149701
|
}
|
|
149687
149702
|
function createCompletionDetails(name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source) {
|
|
149688
149703
|
return { name, kindModifiers, kind, displayParts, documentation, tags, codeActions, source, sourceDisplay: source };
|
|
@@ -150789,6 +150804,16 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
|
|
|
150789
150804
|
return classElementModifierFlags & 32 /* Static */ ? (type == null ? void 0 : type.symbol) && typeChecker.getPropertiesOfType(typeChecker.getTypeOfSymbolAtLocation(type.symbol, decl)) : type && typeChecker.getPropertiesOfType(type);
|
|
150790
150805
|
});
|
|
150791
150806
|
symbols = concatenate(symbols, filterClassMembersList(baseSymbols, decl.members, classElementModifierFlags));
|
|
150807
|
+
forEach(symbols, (symbol, index) => {
|
|
150808
|
+
const declaration = symbol == null ? void 0 : symbol.valueDeclaration;
|
|
150809
|
+
if (declaration && isClassElement(declaration) && declaration.name && isComputedPropertyName(declaration.name)) {
|
|
150810
|
+
const origin = {
|
|
150811
|
+
kind: 512 /* ComputedPropertyName */,
|
|
150812
|
+
symbolName: typeChecker.symbolToString(symbol)
|
|
150813
|
+
};
|
|
150814
|
+
symbolToOriginInfoMap[index] = origin;
|
|
150815
|
+
}
|
|
150816
|
+
});
|
|
150792
150817
|
}
|
|
150793
150818
|
return 1 /* Success */;
|
|
150794
150819
|
}
|
|
@@ -151173,7 +151198,7 @@ function getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind, js
|
|
|
151173
151198
|
}
|
|
151174
151199
|
switch (kind) {
|
|
151175
151200
|
case 3 /* MemberLike */:
|
|
151176
|
-
return void 0;
|
|
151201
|
+
return originIsComputedPropertyName(origin) ? { name: origin.symbolName, needsConvertPropertyAccess: false } : void 0;
|
|
151177
151202
|
case 0 /* ObjectPropertyDeclaration */:
|
|
151178
151203
|
return { name: JSON.stringify(name), needsConvertPropertyAccess: false };
|
|
151179
151204
|
case 2 /* PropertyAccess */:
|
|
@@ -151765,7 +151790,7 @@ function stringLiteralCompletionDetails(name, location, completion, sourceFile,
|
|
|
151765
151790
|
}
|
|
151766
151791
|
case 1 /* Properties */: {
|
|
151767
151792
|
const match = find(completion.symbols, (s) => s.name === name);
|
|
151768
|
-
return match && createCompletionDetailsForSymbol(match, checker, sourceFile, location, cancellationToken);
|
|
151793
|
+
return match && createCompletionDetailsForSymbol(match, match.name, checker, sourceFile, location, cancellationToken);
|
|
151769
151794
|
}
|
|
151770
151795
|
case 2 /* Types */:
|
|
151771
151796
|
return find(completion.types, (t) => t.value === name) ? createCompletionDetails(name, "" /* none */, "string" /* string */, [textPart(name)]) : void 0;
|
|
@@ -169343,8 +169368,6 @@ __export(ts_exports3, {
|
|
|
169343
169368
|
isWithStatement: () => isWithStatement,
|
|
169344
169369
|
isWriteAccess: () => isWriteAccess,
|
|
169345
169370
|
isWriteOnlyAccess: () => isWriteOnlyAccess,
|
|
169346
|
-
isWriteOnlyUsage: () => isWriteOnlyUsage,
|
|
169347
|
-
isWriteUsage: () => isWriteUsage,
|
|
169348
169371
|
isYieldExpression: () => isYieldExpression,
|
|
169349
169372
|
jsxModeNeedsExplicitImport: () => jsxModeNeedsExplicitImport,
|
|
169350
169373
|
keywordPart: () => keywordPart,
|
|
@@ -183295,8 +183318,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
183295
183318
|
isWithStatement,
|
|
183296
183319
|
isWriteAccess,
|
|
183297
183320
|
isWriteOnlyAccess,
|
|
183298
|
-
isWriteOnlyUsage,
|
|
183299
|
-
isWriteUsage,
|
|
183300
183321
|
isYieldExpression,
|
|
183301
183322
|
jsxModeNeedsExplicitImport,
|
|
183302
183323
|
keywordPart,
|