@typescript-deploys/pr-build 5.0.0-pr-50431-13 → 5.0.0-pr-52836-22
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 +163 -122
- package/lib/tsserver.js +185 -138
- package/lib/tsserverlibrary.js +185 -136
- package/lib/typescript.js +185 -134
- package/lib/typingsInstaller.js +40 -44
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
26
|
+
var version = `${versionMajorMinor}.0-insiders.20230218`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -8467,18 +8467,18 @@ function isIdentifierText(name, languageVersion, identifierVariant) {
|
|
|
8467
8467
|
return true;
|
|
8468
8468
|
}
|
|
8469
8469
|
function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Standard */, textInitial, onError, start, length2) {
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
8477
|
-
|
|
8478
|
-
|
|
8479
|
-
|
|
8470
|
+
var text = textInitial;
|
|
8471
|
+
var pos;
|
|
8472
|
+
var end;
|
|
8473
|
+
var startPos;
|
|
8474
|
+
var tokenPos;
|
|
8475
|
+
var token;
|
|
8476
|
+
var tokenValue;
|
|
8477
|
+
var tokenFlags;
|
|
8478
|
+
var commentDirectives;
|
|
8479
|
+
var inJSDocType = 0;
|
|
8480
8480
|
setText(text, start, length2);
|
|
8481
|
-
|
|
8481
|
+
var scanner = {
|
|
8482
8482
|
getStartPos: () => startPos,
|
|
8483
8483
|
getTextPos: () => pos,
|
|
8484
8484
|
getToken: () => token,
|
|
@@ -15652,36 +15652,20 @@ function isWriteOnlyAccess(node) {
|
|
|
15652
15652
|
function isWriteAccess(node) {
|
|
15653
15653
|
return accessKind(node) !== 0 /* Read */;
|
|
15654
15654
|
}
|
|
15655
|
-
function isWriteOnlyUsage(node) {
|
|
15656
|
-
return accessKindForUsageChecks(node) === 1 /* Write */;
|
|
15657
|
-
}
|
|
15658
|
-
function accessKindForUsageChecks(node) {
|
|
15659
|
-
const kind = accessKind(node);
|
|
15660
|
-
const { parent } = node;
|
|
15661
|
-
switch (parent == null ? void 0 : parent.kind) {
|
|
15662
|
-
case 222 /* PostfixUnaryExpression */:
|
|
15663
|
-
case 221 /* PrefixUnaryExpression */:
|
|
15664
|
-
case 223 /* BinaryExpression */:
|
|
15665
|
-
return kind === 2 /* ReadWrite */ ? writeOrReadWrite() : kind;
|
|
15666
|
-
default:
|
|
15667
|
-
return kind;
|
|
15668
|
-
}
|
|
15669
|
-
function writeOrReadWrite() {
|
|
15670
|
-
return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
|
|
15671
|
-
}
|
|
15672
|
-
}
|
|
15673
15655
|
function accessKind(node) {
|
|
15674
15656
|
const { parent } = node;
|
|
15675
|
-
|
|
15657
|
+
if (!parent)
|
|
15658
|
+
return 0 /* Read */;
|
|
15659
|
+
switch (parent.kind) {
|
|
15676
15660
|
case 214 /* ParenthesizedExpression */:
|
|
15677
15661
|
return accessKind(parent);
|
|
15678
15662
|
case 222 /* PostfixUnaryExpression */:
|
|
15679
15663
|
case 221 /* PrefixUnaryExpression */:
|
|
15680
15664
|
const { operator } = parent;
|
|
15681
|
-
return operator === 45 /* PlusPlusToken */ || operator === 46 /* MinusMinusToken */ ?
|
|
15665
|
+
return operator === 45 /* PlusPlusToken */ || operator === 46 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */;
|
|
15682
15666
|
case 223 /* BinaryExpression */:
|
|
15683
15667
|
const { left, operatorToken } = parent;
|
|
15684
|
-
return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* EqualsToken */ ? 1 /* Write */ :
|
|
15668
|
+
return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite() : 0 /* Read */;
|
|
15685
15669
|
case 208 /* PropertyAccessExpression */:
|
|
15686
15670
|
return parent.name !== node ? 0 /* Read */ : accessKind(parent);
|
|
15687
15671
|
case 299 /* PropertyAssignment */: {
|
|
@@ -15695,6 +15679,9 @@ function accessKind(node) {
|
|
|
15695
15679
|
default:
|
|
15696
15680
|
return 0 /* Read */;
|
|
15697
15681
|
}
|
|
15682
|
+
function writeOrReadWrite() {
|
|
15683
|
+
return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
|
|
15684
|
+
}
|
|
15698
15685
|
}
|
|
15699
15686
|
function reverseAccessKind(a) {
|
|
15700
15687
|
switch (a) {
|
|
@@ -26021,22 +26008,22 @@ function isExternalModule(file) {
|
|
|
26021
26008
|
}
|
|
26022
26009
|
var Parser;
|
|
26023
26010
|
((Parser2) => {
|
|
26024
|
-
|
|
26011
|
+
var scanner = createScanner(
|
|
26025
26012
|
99 /* Latest */,
|
|
26026
26013
|
/*skipTrivia*/
|
|
26027
26014
|
true
|
|
26028
26015
|
);
|
|
26029
|
-
|
|
26030
|
-
|
|
26031
|
-
|
|
26032
|
-
|
|
26033
|
-
|
|
26034
|
-
|
|
26016
|
+
var disallowInAndDecoratorContext = 4096 /* DisallowInContext */ | 16384 /* DecoratorContext */;
|
|
26017
|
+
var NodeConstructor2;
|
|
26018
|
+
var TokenConstructor2;
|
|
26019
|
+
var IdentifierConstructor2;
|
|
26020
|
+
var PrivateIdentifierConstructor2;
|
|
26021
|
+
var SourceFileConstructor2;
|
|
26035
26022
|
function countNode(node) {
|
|
26036
26023
|
nodeCount++;
|
|
26037
26024
|
return node;
|
|
26038
26025
|
}
|
|
26039
|
-
|
|
26026
|
+
var baseNodeFactory = {
|
|
26040
26027
|
createBaseSourceFileNode: (kind) => countNode(new SourceFileConstructor2(
|
|
26041
26028
|
kind,
|
|
26042
26029
|
/*pos*/
|
|
@@ -26073,25 +26060,25 @@ var Parser;
|
|
|
26073
26060
|
0
|
|
26074
26061
|
))
|
|
26075
26062
|
};
|
|
26076
|
-
|
|
26077
|
-
|
|
26078
|
-
|
|
26079
|
-
|
|
26080
|
-
|
|
26081
|
-
|
|
26082
|
-
|
|
26083
|
-
|
|
26084
|
-
|
|
26085
|
-
|
|
26086
|
-
|
|
26087
|
-
|
|
26088
|
-
|
|
26089
|
-
|
|
26090
|
-
|
|
26091
|
-
|
|
26092
|
-
|
|
26093
|
-
|
|
26094
|
-
|
|
26063
|
+
var factory2 = createNodeFactory(1 /* NoParenthesizerRules */ | 2 /* NoNodeConverters */ | 8 /* NoOriginalNode */, baseNodeFactory);
|
|
26064
|
+
var fileName;
|
|
26065
|
+
var sourceFlags;
|
|
26066
|
+
var sourceText;
|
|
26067
|
+
var languageVersion;
|
|
26068
|
+
var scriptKind;
|
|
26069
|
+
var languageVariant;
|
|
26070
|
+
var parseDiagnostics;
|
|
26071
|
+
var jsDocDiagnostics;
|
|
26072
|
+
var syntaxCursor;
|
|
26073
|
+
var currentToken;
|
|
26074
|
+
var nodeCount;
|
|
26075
|
+
var identifiers;
|
|
26076
|
+
var identifierCount;
|
|
26077
|
+
var parsingContext;
|
|
26078
|
+
var notParenthesizedArrow;
|
|
26079
|
+
var contextFlags;
|
|
26080
|
+
var topLevel = true;
|
|
26081
|
+
var parseErrorBeforeNextFinishedNode = false;
|
|
26095
26082
|
function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride) {
|
|
26096
26083
|
var _a2;
|
|
26097
26084
|
scriptKind2 = ensureScriptKind(fileName2, scriptKind2);
|
|
@@ -29598,13 +29585,9 @@ var Parser;
|
|
|
29598
29585
|
function parseJsxClosingFragment(inExpressionContext) {
|
|
29599
29586
|
const pos = getNodePos();
|
|
29600
29587
|
parseExpected(30 /* LessThanSlashToken */);
|
|
29601
|
-
if (tokenIsIdentifierOrKeyword(token())) {
|
|
29602
|
-
parseErrorAtRange(parseJsxElementName(), Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
|
|
29603
|
-
}
|
|
29604
29588
|
if (parseExpected(
|
|
29605
29589
|
31 /* GreaterThanToken */,
|
|
29606
|
-
|
|
29607
|
-
void 0,
|
|
29590
|
+
Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment,
|
|
29608
29591
|
/*shouldAdvance*/
|
|
29609
29592
|
false
|
|
29610
29593
|
)) {
|
|
@@ -47305,7 +47288,7 @@ function createTypeChecker(host) {
|
|
|
47305
47288
|
return result;
|
|
47306
47289
|
}
|
|
47307
47290
|
function createAnonymousTypeNode(type2) {
|
|
47308
|
-
var _a3;
|
|
47291
|
+
var _a3, _b2;
|
|
47309
47292
|
const typeId = type2.id;
|
|
47310
47293
|
const symbol = type2.symbol;
|
|
47311
47294
|
if (symbol) {
|
|
@@ -47331,6 +47314,20 @@ function createTypeChecker(host) {
|
|
|
47331
47314
|
return visitAndTransformType(type2, createTypeNodeFromObjectType);
|
|
47332
47315
|
}
|
|
47333
47316
|
} else {
|
|
47317
|
+
const isInstantiationExpressionType = !!(getObjectFlags(type2) & 8388608 /* InstantiationExpressionType */);
|
|
47318
|
+
if (isInstantiationExpressionType) {
|
|
47319
|
+
const instantiationExpressionType = type2;
|
|
47320
|
+
if (isTypeQueryNode(instantiationExpressionType.node)) {
|
|
47321
|
+
const typeNode = serializeExistingTypeNode(context, instantiationExpressionType.node);
|
|
47322
|
+
if (typeNode) {
|
|
47323
|
+
return typeNode;
|
|
47324
|
+
}
|
|
47325
|
+
}
|
|
47326
|
+
if ((_b2 = context.visitedTypes) == null ? void 0 : _b2.has(typeId)) {
|
|
47327
|
+
return createElidedInformationPlaceholder(context);
|
|
47328
|
+
}
|
|
47329
|
+
return visitAndTransformType(type2, createTypeNodeFromObjectType);
|
|
47330
|
+
}
|
|
47334
47331
|
return createTypeNodeFromObjectType(type2);
|
|
47335
47332
|
}
|
|
47336
47333
|
function shouldWriteTypeOfFunctionSymbol() {
|
|
@@ -47839,7 +47836,7 @@ function createTypeChecker(host) {
|
|
|
47839
47836
|
);
|
|
47840
47837
|
}
|
|
47841
47838
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
47842
|
-
var _a2, _b, _c, _d;
|
|
47839
|
+
var _a2, _b, _c, _d, _e;
|
|
47843
47840
|
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
47844
47841
|
if (suppressAny)
|
|
47845
47842
|
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
@@ -47856,6 +47853,39 @@ function createTypeChecker(host) {
|
|
|
47856
47853
|
/*skipUnionExpanding*/
|
|
47857
47854
|
true
|
|
47858
47855
|
)[0];
|
|
47856
|
+
let cleanup;
|
|
47857
|
+
if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) {
|
|
47858
|
+
const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0;
|
|
47859
|
+
Debug.assertOptionalNode(existingFakeScope, isBlock);
|
|
47860
|
+
const locals = (_a2 = existingFakeScope == null ? void 0 : existingFakeScope.locals) != null ? _a2 : createSymbolTable();
|
|
47861
|
+
let newLocals;
|
|
47862
|
+
for (const param of expandedParams) {
|
|
47863
|
+
if (!locals.has(param.escapedName)) {
|
|
47864
|
+
newLocals = append(newLocals, param.escapedName);
|
|
47865
|
+
locals.set(param.escapedName, param);
|
|
47866
|
+
}
|
|
47867
|
+
}
|
|
47868
|
+
if (newLocals) {
|
|
47869
|
+
let removeNewLocals2 = function() {
|
|
47870
|
+
forEach(newLocals, (s) => locals.delete(s));
|
|
47871
|
+
};
|
|
47872
|
+
var removeNewLocals = removeNewLocals2;
|
|
47873
|
+
if (existingFakeScope) {
|
|
47874
|
+
cleanup = removeNewLocals2;
|
|
47875
|
+
} else {
|
|
47876
|
+
const fakeScope = parseNodeFactory.createBlock(emptyArray);
|
|
47877
|
+
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = true;
|
|
47878
|
+
fakeScope.locals = locals;
|
|
47879
|
+
const saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
47880
|
+
setParent(fakeScope, saveEnclosingDeclaration);
|
|
47881
|
+
context.enclosingDeclaration = fakeScope;
|
|
47882
|
+
cleanup = () => {
|
|
47883
|
+
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
47884
|
+
removeNewLocals2();
|
|
47885
|
+
};
|
|
47886
|
+
}
|
|
47887
|
+
}
|
|
47888
|
+
}
|
|
47859
47889
|
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));
|
|
47860
47890
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
47861
47891
|
if (thisParameter) {
|
|
@@ -47881,11 +47911,11 @@ function createTypeChecker(host) {
|
|
|
47881
47911
|
const flags = modifiersToFlags(modifiers);
|
|
47882
47912
|
modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */);
|
|
47883
47913
|
}
|
|
47884
|
-
const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (
|
|
47914
|
+
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(
|
|
47885
47915
|
modifiers,
|
|
47886
47916
|
/*asteriskToken*/
|
|
47887
47917
|
void 0,
|
|
47888
|
-
(
|
|
47918
|
+
(_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""),
|
|
47889
47919
|
/*questionToken*/
|
|
47890
47920
|
void 0,
|
|
47891
47921
|
typeParameters,
|
|
@@ -47900,14 +47930,14 @@ function createTypeChecker(host) {
|
|
|
47900
47930
|
void 0
|
|
47901
47931
|
) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration(
|
|
47902
47932
|
modifiers,
|
|
47903
|
-
(
|
|
47933
|
+
(_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""),
|
|
47904
47934
|
parameters,
|
|
47905
47935
|
returnTypeNode,
|
|
47906
47936
|
/*body*/
|
|
47907
47937
|
void 0
|
|
47908
47938
|
) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration(
|
|
47909
47939
|
modifiers,
|
|
47910
|
-
(
|
|
47940
|
+
(_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""),
|
|
47911
47941
|
parameters,
|
|
47912
47942
|
/*body*/
|
|
47913
47943
|
void 0
|
|
@@ -47942,6 +47972,7 @@ function createTypeChecker(host) {
|
|
|
47942
47972
|
if (typeArguments) {
|
|
47943
47973
|
node.typeArguments = factory.createNodeArray(typeArguments);
|
|
47944
47974
|
}
|
|
47975
|
+
cleanup == null ? void 0 : cleanup();
|
|
47945
47976
|
return node;
|
|
47946
47977
|
}
|
|
47947
47978
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -48556,9 +48587,12 @@ function createTypeChecker(host) {
|
|
|
48556
48587
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
48557
48588
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
48558
48589
|
}
|
|
48590
|
+
function getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration) {
|
|
48591
|
+
return getNodeLinks(enclosingDeclaration).fakeScopeForSignatureDeclaration ? enclosingDeclaration.parent : enclosingDeclaration;
|
|
48592
|
+
}
|
|
48559
48593
|
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
48560
48594
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
48561
|
-
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration);
|
|
48595
|
+
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
48562
48596
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
48563
48597
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
48564
48598
|
if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
@@ -48590,7 +48624,8 @@ function createTypeChecker(host) {
|
|
|
48590
48624
|
function serializeReturnTypeForSignature(context, type, signature, includePrivateSymbol, bundled) {
|
|
48591
48625
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
48592
48626
|
const annotation = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
|
|
48593
|
-
|
|
48627
|
+
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
48628
|
+
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
48594
48629
|
const annotated = getTypeFromTypeNode(annotation);
|
|
48595
48630
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
48596
48631
|
if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
|
|
@@ -56352,31 +56387,21 @@ function createTypeChecker(host) {
|
|
|
56352
56387
|
}
|
|
56353
56388
|
return type;
|
|
56354
56389
|
function addSpans(texts2, types2) {
|
|
56355
|
-
const isTextsArray = isArray(texts2);
|
|
56356
56390
|
for (let i = 0; i < types2.length; i++) {
|
|
56357
56391
|
const t = types2[i];
|
|
56358
|
-
const addText = isTextsArray ? texts2[i + 1] : texts2;
|
|
56359
56392
|
if (t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) {
|
|
56360
56393
|
text += getTemplateStringForType(t) || "";
|
|
56361
|
-
text +=
|
|
56362
|
-
if (!isTextsArray)
|
|
56363
|
-
return true;
|
|
56394
|
+
text += texts2[i + 1];
|
|
56364
56395
|
} else if (t.flags & 134217728 /* TemplateLiteral */) {
|
|
56365
56396
|
text += t.texts[0];
|
|
56366
56397
|
if (!addSpans(t.texts, t.types))
|
|
56367
56398
|
return false;
|
|
56368
|
-
text +=
|
|
56369
|
-
|
|
56370
|
-
return true;
|
|
56371
|
-
} else if (isGenericIndexType(t) || isPatternLiteralPlaceholderType(t)) {
|
|
56399
|
+
text += texts2[i + 1];
|
|
56400
|
+
} else if (isGenericIndexType(t) || isPatternLiteralPlaceholderType(t) || t.flags & 2097152 /* Intersection */) {
|
|
56372
56401
|
newTypes.push(t);
|
|
56373
56402
|
newTexts.push(text);
|
|
56374
|
-
text =
|
|
56375
|
-
} else
|
|
56376
|
-
const added = addSpans(texts2[i + 1], t.types);
|
|
56377
|
-
if (!added)
|
|
56378
|
-
return false;
|
|
56379
|
-
} else if (isTextsArray) {
|
|
56403
|
+
text = texts2[i + 1];
|
|
56404
|
+
} else {
|
|
56380
56405
|
return false;
|
|
56381
56406
|
}
|
|
56382
56407
|
}
|
|
@@ -56388,6 +56413,11 @@ function createTypeChecker(host) {
|
|
|
56388
56413
|
}
|
|
56389
56414
|
function createTemplateLiteralType(texts, types) {
|
|
56390
56415
|
const type = createType(134217728 /* TemplateLiteral */);
|
|
56416
|
+
type.objectFlags = getPropagatingFlagsOfTypes(
|
|
56417
|
+
types,
|
|
56418
|
+
/*excludeKinds*/
|
|
56419
|
+
98304 /* Nullable */
|
|
56420
|
+
);
|
|
56391
56421
|
type.texts = texts;
|
|
56392
56422
|
type.types = types;
|
|
56393
56423
|
return type;
|
|
@@ -56702,7 +56732,7 @@ function createTypeChecker(host) {
|
|
|
56702
56732
|
return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
|
|
56703
56733
|
}
|
|
56704
56734
|
function getGenericObjectFlags(type) {
|
|
56705
|
-
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
56735
|
+
if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
|
|
56706
56736
|
if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
|
|
56707
56737
|
type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
|
|
56708
56738
|
}
|
|
@@ -56714,7 +56744,7 @@ function createTypeChecker(host) {
|
|
|
56714
56744
|
}
|
|
56715
56745
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
56716
56746
|
}
|
|
56717
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ |
|
|
56747
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
56718
56748
|
}
|
|
56719
56749
|
function getSimplifiedType(type, writing) {
|
|
56720
56750
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -61892,7 +61922,7 @@ function createTypeChecker(host) {
|
|
|
61892
61922
|
const restType = getRestTypeOfTupleType(type);
|
|
61893
61923
|
return restType && createArrayType(restType);
|
|
61894
61924
|
}
|
|
61895
|
-
function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false) {
|
|
61925
|
+
function getElementTypeOfSliceOfTupleType(type, index, endSkipCount = 0, writing = false, noReductions = false) {
|
|
61896
61926
|
const length2 = getTypeReferenceArity(type) - endSkipCount;
|
|
61897
61927
|
if (index < length2) {
|
|
61898
61928
|
const typeArguments = getTypeArguments(type);
|
|
@@ -61901,7 +61931,7 @@ function createTypeChecker(host) {
|
|
|
61901
61931
|
const t = typeArguments[i];
|
|
61902
61932
|
elementTypes.push(type.target.elementFlags[i] & 8 /* Variadic */ ? getIndexedAccessType(t, numberType) : t);
|
|
61903
61933
|
}
|
|
61904
|
-
return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes);
|
|
61934
|
+
return writing ? getIntersectionType(elementTypes) : getUnionType(elementTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
|
|
61905
61935
|
}
|
|
61906
61936
|
return void 0;
|
|
61907
61937
|
}
|
|
@@ -63368,7 +63398,7 @@ function createTypeChecker(host) {
|
|
|
63368
63398
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
|
63369
63399
|
getCannotFindNameDiagnosticForName(node),
|
|
63370
63400
|
node,
|
|
63371
|
-
!
|
|
63401
|
+
!isWriteOnlyAccess(node),
|
|
63372
63402
|
/*excludeGlobals*/
|
|
63373
63403
|
false
|
|
63374
63404
|
) || unknownSymbol;
|
|
@@ -66488,9 +66518,18 @@ function createTypeChecker(host) {
|
|
|
66488
66518
|
if (prop) {
|
|
66489
66519
|
return isCircularMappedProperty(prop) ? void 0 : getTypeOfSymbol(prop);
|
|
66490
66520
|
}
|
|
66491
|
-
if (isTupleType(t)) {
|
|
66492
|
-
const restType =
|
|
66493
|
-
|
|
66521
|
+
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
66522
|
+
const restType = getElementTypeOfSliceOfTupleType(
|
|
66523
|
+
t,
|
|
66524
|
+
t.target.fixedLength,
|
|
66525
|
+
/*endSkipCount*/
|
|
66526
|
+
0,
|
|
66527
|
+
/*writing*/
|
|
66528
|
+
false,
|
|
66529
|
+
/*noReductions*/
|
|
66530
|
+
true
|
|
66531
|
+
);
|
|
66532
|
+
if (restType) {
|
|
66494
66533
|
return restType;
|
|
66495
66534
|
}
|
|
66496
66535
|
}
|
|
@@ -66537,9 +66576,18 @@ function createTypeChecker(host) {
|
|
|
66537
66576
|
return void 0;
|
|
66538
66577
|
}
|
|
66539
66578
|
function getContextualTypeForElementExpression(arrayContextualType, index) {
|
|
66540
|
-
return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
66579
|
+
return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType(
|
|
66541
66580
|
arrayContextualType,
|
|
66542
|
-
(t) =>
|
|
66581
|
+
(t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType(
|
|
66582
|
+
t,
|
|
66583
|
+
0,
|
|
66584
|
+
/*endSkipCount*/
|
|
66585
|
+
0,
|
|
66586
|
+
/*writing*/
|
|
66587
|
+
false,
|
|
66588
|
+
/*noReductions*/
|
|
66589
|
+
true
|
|
66590
|
+
) : getIteratedTypeOrElementType(
|
|
66543
66591
|
1 /* Element */,
|
|
66544
66592
|
t,
|
|
66545
66593
|
undefinedType,
|
|
@@ -66692,6 +66740,7 @@ function createTypeChecker(host) {
|
|
|
66692
66740
|
return type;
|
|
66693
66741
|
}
|
|
66694
66742
|
function getContextualType(node, contextFlags) {
|
|
66743
|
+
var _a2, _b;
|
|
66695
66744
|
if (node.flags & 33554432 /* InWithStatement */) {
|
|
66696
66745
|
return void 0;
|
|
66697
66746
|
}
|
|
@@ -66736,7 +66785,9 @@ function createTypeChecker(host) {
|
|
|
66736
66785
|
case 206 /* ArrayLiteralExpression */: {
|
|
66737
66786
|
const arrayLiteral = parent;
|
|
66738
66787
|
const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
|
|
66739
|
-
|
|
66788
|
+
const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement);
|
|
66789
|
+
const elementIndex = indexOfNode(arrayLiteral.elements, node);
|
|
66790
|
+
return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1);
|
|
66740
66791
|
}
|
|
66741
66792
|
case 224 /* ConditionalExpression */:
|
|
66742
66793
|
return getContextualTypeForConditionalOperand(node, contextFlags);
|
|
@@ -68186,8 +68237,8 @@ function createTypeChecker(host) {
|
|
|
68186
68237
|
}
|
|
68187
68238
|
return nonNullType;
|
|
68188
68239
|
}
|
|
68189
|
-
function checkPropertyAccessExpression(node, checkMode
|
|
68190
|
-
return node.flags & 32 /* OptionalChain */ ? checkPropertyAccessChain(node, checkMode) : checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode
|
|
68240
|
+
function checkPropertyAccessExpression(node, checkMode) {
|
|
68241
|
+
return node.flags & 32 /* OptionalChain */ ? checkPropertyAccessChain(node, checkMode) : checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode);
|
|
68191
68242
|
}
|
|
68192
68243
|
function checkPropertyAccessChain(node, checkMode) {
|
|
68193
68244
|
const leftType = checkExpression(node.expression);
|
|
@@ -68318,7 +68369,7 @@ function createTypeChecker(host) {
|
|
|
68318
68369
|
false
|
|
68319
68370
|
) === getDeclaringConstructor(prop);
|
|
68320
68371
|
}
|
|
68321
|
-
function checkPropertyAccessExpressionOrQualifiedName(node, left, leftType, right, checkMode
|
|
68372
|
+
function checkPropertyAccessExpressionOrQualifiedName(node, left, leftType, right, checkMode) {
|
|
68322
68373
|
const parentSymbol = getNodeLinks(left).resolvedSymbol;
|
|
68323
68374
|
const assignmentKind = getAssignmentTargetKind(node);
|
|
68324
68375
|
const apparentType = getApparentType(assignmentKind !== 0 /* None */ || isMethodAccessForCall(node) ? getWidenedType(leftType) : leftType);
|
|
@@ -68417,12 +68468,13 @@ function createTypeChecker(host) {
|
|
|
68417
68468
|
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
|
|
68418
68469
|
markPropertyAsReferenced(prop, node, isSelfTypeAccess(left, parentSymbol));
|
|
68419
68470
|
getNodeLinks(node).resolvedSymbol = prop;
|
|
68420
|
-
|
|
68471
|
+
const writing = isWriteAccess(node);
|
|
68472
|
+
checkPropertyAccessibility(node, left.kind === 106 /* SuperKeyword */, writing, apparentType, prop);
|
|
68421
68473
|
if (isAssignmentToReadonlyEntity(node, prop, assignmentKind)) {
|
|
68422
68474
|
error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right));
|
|
68423
68475
|
return errorType;
|
|
68424
68476
|
}
|
|
68425
|
-
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType :
|
|
68477
|
+
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writing ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
|
|
68426
68478
|
}
|
|
68427
68479
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
68428
68480
|
}
|
|
@@ -68738,7 +68790,7 @@ function createTypeChecker(host) {
|
|
|
68738
68790
|
if (!hasPrivateModifier && !hasPrivateIdentifier) {
|
|
68739
68791
|
return;
|
|
68740
68792
|
}
|
|
68741
|
-
if (nodeForCheckWriteOnly &&
|
|
68793
|
+
if (nodeForCheckWriteOnly && isWriteOnlyAccess(nodeForCheckWriteOnly) && !(prop.flags & 65536 /* SetAccessor */)) {
|
|
68742
68794
|
return;
|
|
68743
68795
|
}
|
|
68744
68796
|
if (isSelfTypeAccess2) {
|
|
@@ -73052,16 +73104,6 @@ function createTypeChecker(host) {
|
|
|
73052
73104
|
addLazyDiagnostic(checkAssignmentOperatorWorker);
|
|
73053
73105
|
}
|
|
73054
73106
|
function checkAssignmentOperatorWorker() {
|
|
73055
|
-
let assigneeType = leftType;
|
|
73056
|
-
if (isCompoundAssignment(operatorToken.kind) && left.kind === 208 /* PropertyAccessExpression */) {
|
|
73057
|
-
assigneeType = checkPropertyAccessExpression(
|
|
73058
|
-
left,
|
|
73059
|
-
/*checkMode*/
|
|
73060
|
-
void 0,
|
|
73061
|
-
/*writeOnly*/
|
|
73062
|
-
true
|
|
73063
|
-
);
|
|
73064
|
-
}
|
|
73065
73107
|
if (checkReferenceExpression(
|
|
73066
73108
|
left,
|
|
73067
73109
|
Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access,
|
|
@@ -73074,7 +73116,7 @@ function createTypeChecker(host) {
|
|
|
73074
73116
|
headMessage = Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target;
|
|
73075
73117
|
}
|
|
73076
73118
|
}
|
|
73077
|
-
checkTypeAssignableToAndOptionallyElaborate(valueType,
|
|
73119
|
+
checkTypeAssignableToAndOptionallyElaborate(valueType, leftType, left, right, headMessage);
|
|
73078
73120
|
}
|
|
73079
73121
|
}
|
|
73080
73122
|
}
|
|
@@ -77844,20 +77886,19 @@ function createTypeChecker(host) {
|
|
|
77844
77886
|
}
|
|
77845
77887
|
}
|
|
77846
77888
|
}
|
|
77847
|
-
function getMemberOverrideModifierStatus(node, member) {
|
|
77889
|
+
function getMemberOverrideModifierStatus(node, member, memberSymbol) {
|
|
77848
77890
|
if (!member.name) {
|
|
77849
77891
|
return 0 /* Ok */;
|
|
77850
77892
|
}
|
|
77851
|
-
const
|
|
77852
|
-
const type = getDeclaredTypeOfSymbol(
|
|
77893
|
+
const classSymbol = getSymbolOfDeclaration(node);
|
|
77894
|
+
const type = getDeclaredTypeOfSymbol(classSymbol);
|
|
77853
77895
|
const typeWithThis = getTypeWithThisArgument(type);
|
|
77854
|
-
const staticType = getTypeOfSymbol(
|
|
77896
|
+
const staticType = getTypeOfSymbol(classSymbol);
|
|
77855
77897
|
const baseTypeNode = getEffectiveBaseTypeNode(node);
|
|
77856
77898
|
const baseTypes = baseTypeNode && getBaseTypes(type);
|
|
77857
77899
|
const baseWithThis = (baseTypes == null ? void 0 : baseTypes.length) ? getTypeWithThisArgument(first(baseTypes), type.thisType) : void 0;
|
|
77858
77900
|
const baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
77859
77901
|
const memberHasOverrideModifier = member.parent ? hasOverrideModifier(member) : hasSyntacticModifier(member, 16384 /* Override */);
|
|
77860
|
-
const memberName = unescapeLeadingUnderscores(getTextOfPropertyName(member.name));
|
|
77861
77902
|
return checkMemberForOverrideModifier(
|
|
77862
77903
|
node,
|
|
77863
77904
|
staticType,
|
|
@@ -77870,7 +77911,7 @@ function createTypeChecker(host) {
|
|
|
77870
77911
|
isStatic(member),
|
|
77871
77912
|
/* memberIsParameterProperty */
|
|
77872
77913
|
false,
|
|
77873
|
-
|
|
77914
|
+
symbolName(memberSymbol)
|
|
77874
77915
|
);
|
|
77875
77916
|
}
|
|
77876
77917
|
function getTargetSymbol(s) {
|