@typescript-deploys/pr-build 5.0.0-pr-52807-23 → 5.0.0-pr-50431-13
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 +63 -46
- package/lib/tsserver.js +114 -48
- package/lib/tsserverlibrary.js +111 -48
- package/lib/typescript.js +108 -48
- package/lib/typingsInstaller.js +2 -3
- 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.20230217`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -15652,20 +15652,36 @@ 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
|
+
}
|
|
15655
15673
|
function accessKind(node) {
|
|
15656
15674
|
const { parent } = node;
|
|
15657
|
-
|
|
15658
|
-
return 0 /* Read */;
|
|
15659
|
-
switch (parent.kind) {
|
|
15675
|
+
switch (parent == null ? void 0 : parent.kind) {
|
|
15660
15676
|
case 214 /* ParenthesizedExpression */:
|
|
15661
15677
|
return accessKind(parent);
|
|
15662
15678
|
case 222 /* PostfixUnaryExpression */:
|
|
15663
15679
|
case 221 /* PrefixUnaryExpression */:
|
|
15664
15680
|
const { operator } = parent;
|
|
15665
|
-
return operator === 45 /* PlusPlusToken */ || operator === 46 /* MinusMinusToken */ ?
|
|
15681
|
+
return operator === 45 /* PlusPlusToken */ || operator === 46 /* MinusMinusToken */ ? 2 /* ReadWrite */ : 0 /* Read */;
|
|
15666
15682
|
case 223 /* BinaryExpression */:
|
|
15667
15683
|
const { left, operatorToken } = parent;
|
|
15668
|
-
return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* EqualsToken */ ? 1 /* Write */ :
|
|
15684
|
+
return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* EqualsToken */ ? 1 /* Write */ : 2 /* ReadWrite */ : 0 /* Read */;
|
|
15669
15685
|
case 208 /* PropertyAccessExpression */:
|
|
15670
15686
|
return parent.name !== node ? 0 /* Read */ : accessKind(parent);
|
|
15671
15687
|
case 299 /* PropertyAssignment */: {
|
|
@@ -15679,9 +15695,6 @@ function accessKind(node) {
|
|
|
15679
15695
|
default:
|
|
15680
15696
|
return 0 /* Read */;
|
|
15681
15697
|
}
|
|
15682
|
-
function writeOrReadWrite() {
|
|
15683
|
-
return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
|
|
15684
|
-
}
|
|
15685
15698
|
}
|
|
15686
15699
|
function reverseAccessKind(a) {
|
|
15687
15700
|
switch (a) {
|
|
@@ -24988,7 +25001,7 @@ function canHaveIllegalDecorators(node) {
|
|
|
24988
25001
|
}
|
|
24989
25002
|
function canHaveIllegalModifiers(node) {
|
|
24990
25003
|
const kind = node.kind;
|
|
24991
|
-
return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind ===
|
|
25004
|
+
return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */;
|
|
24992
25005
|
}
|
|
24993
25006
|
function isQuestionOrExclamationToken(node) {
|
|
24994
25007
|
return isQuestionToken(node) || isExclamationToken(node);
|
|
@@ -28280,6 +28293,7 @@ var Parser;
|
|
|
28280
28293
|
const hasJSDoc = hasPrecedingJSDocComment();
|
|
28281
28294
|
const modifiers = parseModifiersForConstructorType();
|
|
28282
28295
|
const isConstructorType = parseOptional(103 /* NewKeyword */);
|
|
28296
|
+
Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers.");
|
|
28283
28297
|
const typeParameters = parseTypeParameters();
|
|
28284
28298
|
const parameters = parseParameters(4 /* Type */);
|
|
28285
28299
|
const type = parseReturnType(
|
|
@@ -28288,8 +28302,6 @@ var Parser;
|
|
|
28288
28302
|
false
|
|
28289
28303
|
);
|
|
28290
28304
|
const node = isConstructorType ? factory2.createConstructorTypeNode(modifiers, typeParameters, parameters, type) : factory2.createFunctionTypeNode(typeParameters, parameters, type);
|
|
28291
|
-
if (!isConstructorType)
|
|
28292
|
-
node.modifiers = modifiers;
|
|
28293
28305
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
28294
28306
|
}
|
|
28295
28307
|
function parseKeywordAndNoDot() {
|
|
@@ -42585,6 +42597,7 @@ function createTypeChecker(host) {
|
|
|
42585
42597
|
let inlineLevel = 0;
|
|
42586
42598
|
let currentNode;
|
|
42587
42599
|
let varianceTypeParameter;
|
|
42600
|
+
let isInferencePartiallyBlocked = false;
|
|
42588
42601
|
const emptySymbols = createSymbolTable();
|
|
42589
42602
|
const arrayVariances = [1 /* Covariant */];
|
|
42590
42603
|
const compilerOptions = host.getCompilerOptions();
|
|
@@ -43016,7 +43029,9 @@ function createTypeChecker(host) {
|
|
|
43016
43029
|
toMarkSkip = toMarkSkip.parent;
|
|
43017
43030
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
43018
43031
|
}
|
|
43032
|
+
isInferencePartiallyBlocked = true;
|
|
43019
43033
|
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
43034
|
+
isInferencePartiallyBlocked = false;
|
|
43020
43035
|
if (containingCall) {
|
|
43021
43036
|
let toMarkSkip = node;
|
|
43022
43037
|
do {
|
|
@@ -53062,6 +53077,7 @@ function createTypeChecker(host) {
|
|
|
53062
53077
|
const typeParameter = getTypeParameterFromMappedType(type);
|
|
53063
53078
|
const constraintType = getConstraintTypeFromMappedType(type);
|
|
53064
53079
|
const nameType = getNameTypeFromMappedType(type.target || type);
|
|
53080
|
+
const isFilteringMappedType = nameType && isTypeAssignableTo(nameType, typeParameter);
|
|
53065
53081
|
const templateType = getTemplateTypeFromMappedType(type.target || type);
|
|
53066
53082
|
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
53067
53083
|
const templateModifiers = getMappedTypeModifiers(type);
|
|
@@ -53099,7 +53115,7 @@ function createTypeChecker(host) {
|
|
|
53099
53115
|
prop.links.keyType = keyType;
|
|
53100
53116
|
if (modifiersProp) {
|
|
53101
53117
|
prop.links.syntheticOrigin = modifiersProp;
|
|
53102
|
-
prop.declarations = nameType
|
|
53118
|
+
prop.declarations = !nameType || isFilteringMappedType ? modifiersProp.declarations : void 0;
|
|
53103
53119
|
}
|
|
53104
53120
|
members.set(propName, prop);
|
|
53105
53121
|
}
|
|
@@ -61834,17 +61850,6 @@ function createTypeChecker(host) {
|
|
|
61834
61850
|
function getBaseTypeOfLiteralTypeForComparison(type) {
|
|
61835
61851
|
return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
|
|
61836
61852
|
}
|
|
61837
|
-
function getValueOfResult(type) {
|
|
61838
|
-
const valueOf = getPropertyOfType(type, "valueOf");
|
|
61839
|
-
if (valueOf) {
|
|
61840
|
-
const signatures = getSignaturesOfType(getTypeOfSymbol(valueOf), 0 /* Call */);
|
|
61841
|
-
if (signatures && signatures.length > 0) {
|
|
61842
|
-
const returnType = getReturnTypeOfSignature(signatures[0]);
|
|
61843
|
-
return returnType;
|
|
61844
|
-
}
|
|
61845
|
-
}
|
|
61846
|
-
return type;
|
|
61847
|
-
}
|
|
61848
61853
|
function getWidenedLiteralType(type) {
|
|
61849
61854
|
return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
|
|
61850
61855
|
}
|
|
@@ -63363,7 +63368,7 @@ function createTypeChecker(host) {
|
|
|
63363
63368
|
111551 /* Value */ | 1048576 /* ExportValue */,
|
|
63364
63369
|
getCannotFindNameDiagnosticForName(node),
|
|
63365
63370
|
node,
|
|
63366
|
-
!
|
|
63371
|
+
!isWriteOnlyUsage(node),
|
|
63367
63372
|
/*excludeGlobals*/
|
|
63368
63373
|
false
|
|
63369
63374
|
) || unknownSymbol;
|
|
@@ -68181,8 +68186,8 @@ function createTypeChecker(host) {
|
|
|
68181
68186
|
}
|
|
68182
68187
|
return nonNullType;
|
|
68183
68188
|
}
|
|
68184
|
-
function checkPropertyAccessExpression(node, checkMode) {
|
|
68185
|
-
return node.flags & 32 /* OptionalChain */ ? checkPropertyAccessChain(node, checkMode) : checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode);
|
|
68189
|
+
function checkPropertyAccessExpression(node, checkMode, writeOnly) {
|
|
68190
|
+
return node.flags & 32 /* OptionalChain */ ? checkPropertyAccessChain(node, checkMode) : checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode, writeOnly);
|
|
68186
68191
|
}
|
|
68187
68192
|
function checkPropertyAccessChain(node, checkMode) {
|
|
68188
68193
|
const leftType = checkExpression(node.expression);
|
|
@@ -68313,7 +68318,7 @@ function createTypeChecker(host) {
|
|
|
68313
68318
|
false
|
|
68314
68319
|
) === getDeclaringConstructor(prop);
|
|
68315
68320
|
}
|
|
68316
|
-
function checkPropertyAccessExpressionOrQualifiedName(node, left, leftType, right, checkMode) {
|
|
68321
|
+
function checkPropertyAccessExpressionOrQualifiedName(node, left, leftType, right, checkMode, writeOnly) {
|
|
68317
68322
|
const parentSymbol = getNodeLinks(left).resolvedSymbol;
|
|
68318
68323
|
const assignmentKind = getAssignmentTargetKind(node);
|
|
68319
68324
|
const apparentType = getApparentType(assignmentKind !== 0 /* None */ || isMethodAccessForCall(node) ? getWidenedType(leftType) : leftType);
|
|
@@ -68412,13 +68417,12 @@ function createTypeChecker(host) {
|
|
|
68412
68417
|
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
|
|
68413
68418
|
markPropertyAsReferenced(prop, node, isSelfTypeAccess(left, parentSymbol));
|
|
68414
68419
|
getNodeLinks(node).resolvedSymbol = prop;
|
|
68415
|
-
|
|
68416
|
-
checkPropertyAccessibility(node, left.kind === 106 /* SuperKeyword */, writing, apparentType, prop);
|
|
68420
|
+
checkPropertyAccessibility(node, left.kind === 106 /* SuperKeyword */, isWriteAccess(node), apparentType, prop);
|
|
68417
68421
|
if (isAssignmentToReadonlyEntity(node, prop, assignmentKind)) {
|
|
68418
68422
|
error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right));
|
|
68419
68423
|
return errorType;
|
|
68420
68424
|
}
|
|
68421
|
-
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType :
|
|
68425
|
+
propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writeOnly || isWriteOnlyAccess(node) ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop);
|
|
68422
68426
|
}
|
|
68423
68427
|
return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode);
|
|
68424
68428
|
}
|
|
@@ -68734,7 +68738,7 @@ function createTypeChecker(host) {
|
|
|
68734
68738
|
if (!hasPrivateModifier && !hasPrivateIdentifier) {
|
|
68735
68739
|
return;
|
|
68736
68740
|
}
|
|
68737
|
-
if (nodeForCheckWriteOnly &&
|
|
68741
|
+
if (nodeForCheckWriteOnly && isWriteOnlyUsage(nodeForCheckWriteOnly) && !(prop.flags & 65536 /* SetAccessor */)) {
|
|
68738
68742
|
return;
|
|
68739
68743
|
}
|
|
68740
68744
|
if (isSelfTypeAccess2) {
|
|
@@ -69669,7 +69673,7 @@ function createTypeChecker(host) {
|
|
|
69669
69673
|
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
|
|
69670
69674
|
const isDecorator2 = node.kind === 167 /* Decorator */;
|
|
69671
69675
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
69672
|
-
const reportErrors2 = !candidatesOutArray;
|
|
69676
|
+
const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray;
|
|
69673
69677
|
let typeArguments;
|
|
69674
69678
|
if (!isDecorator2 && !isSuperCall(node)) {
|
|
69675
69679
|
typeArguments = node.typeArguments;
|
|
@@ -72916,17 +72920,9 @@ function createTypeChecker(host) {
|
|
|
72916
72920
|
if (isTypeAny(left2) || isTypeAny(right2)) {
|
|
72917
72921
|
return true;
|
|
72918
72922
|
}
|
|
72919
|
-
if (!(left2.flags & 134348796 /* Primitive */))
|
|
72920
|
-
left2 = getValueOfResult(left2);
|
|
72921
|
-
if (!(right2.flags & 134348796 /* Primitive */))
|
|
72922
|
-
right2 = getValueOfResult(right2);
|
|
72923
72923
|
const leftAssignableToNumber = isTypeAssignableTo(left2, numberOrBigIntType);
|
|
72924
|
-
|
|
72925
|
-
|
|
72926
|
-
if (rightAssignableToNumber)
|
|
72927
|
-
return true;
|
|
72928
|
-
}
|
|
72929
|
-
return isTypeAssignableTo(left2, stringType) && isTypeAssignableTo(right2, stringType);
|
|
72924
|
+
const rightAssignableToNumber = isTypeAssignableTo(right2, numberOrBigIntType);
|
|
72925
|
+
return leftAssignableToNumber && rightAssignableToNumber || !leftAssignableToNumber && !rightAssignableToNumber && areTypesComparable(left2, right2);
|
|
72930
72926
|
});
|
|
72931
72927
|
}
|
|
72932
72928
|
return booleanType;
|
|
@@ -73056,6 +73052,16 @@ function createTypeChecker(host) {
|
|
|
73056
73052
|
addLazyDiagnostic(checkAssignmentOperatorWorker);
|
|
73057
73053
|
}
|
|
73058
73054
|
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
|
+
}
|
|
73059
73065
|
if (checkReferenceExpression(
|
|
73060
73066
|
left,
|
|
73061
73067
|
Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access,
|
|
@@ -73068,7 +73074,7 @@ function createTypeChecker(host) {
|
|
|
73068
73074
|
headMessage = Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target;
|
|
73069
73075
|
}
|
|
73070
73076
|
}
|
|
73071
|
-
checkTypeAssignableToAndOptionallyElaborate(valueType,
|
|
73077
|
+
checkTypeAssignableToAndOptionallyElaborate(valueType, assigneeType, left, right, headMessage);
|
|
73072
73078
|
}
|
|
73073
73079
|
}
|
|
73074
73080
|
}
|
|
@@ -74755,6 +74761,17 @@ function createTypeChecker(host) {
|
|
|
74755
74761
|
lastSeenNonAmbientDeclaration = node;
|
|
74756
74762
|
}
|
|
74757
74763
|
}
|
|
74764
|
+
if (isInJSFile(current) && isFunctionLike(current) && current.jsDoc) {
|
|
74765
|
+
for (const node2 of current.jsDoc) {
|
|
74766
|
+
if (node2.tags) {
|
|
74767
|
+
for (const tag of node2.tags) {
|
|
74768
|
+
if (isJSDocOverloadTag(tag)) {
|
|
74769
|
+
hasOverloads = true;
|
|
74770
|
+
}
|
|
74771
|
+
}
|
|
74772
|
+
}
|
|
74773
|
+
}
|
|
74774
|
+
}
|
|
74758
74775
|
}
|
|
74759
74776
|
}
|
|
74760
74777
|
if (multipleConstructorImplementation) {
|
|
@@ -74792,8 +74809,9 @@ function createTypeChecker(host) {
|
|
|
74792
74809
|
const bodySignature = getSignatureFromDeclaration(bodyDeclaration);
|
|
74793
74810
|
for (const signature of signatures) {
|
|
74794
74811
|
if (!isImplementationCompatibleWithOverload(bodySignature, signature)) {
|
|
74812
|
+
const errorNode = signature.declaration && isJSDocSignature(signature.declaration) ? signature.declaration.parent.tagName : signature.declaration;
|
|
74795
74813
|
addRelatedInfo(
|
|
74796
|
-
error(
|
|
74814
|
+
error(errorNode, Diagnostics.This_overload_signature_is_not_compatible_with_its_implementation_signature),
|
|
74797
74815
|
createDiagnosticForNode(bodyDeclaration, Diagnostics.The_implementation_signature_is_declared_here)
|
|
74798
74816
|
);
|
|
74799
74817
|
break;
|
|
@@ -81409,7 +81427,6 @@ function createTypeChecker(host) {
|
|
|
81409
81427
|
case 299 /* PropertyAssignment */:
|
|
81410
81428
|
case 300 /* ShorthandPropertyAssignment */:
|
|
81411
81429
|
case 267 /* NamespaceExportDeclaration */:
|
|
81412
|
-
case 181 /* FunctionType */:
|
|
81413
81430
|
case 279 /* MissingDeclaration */:
|
|
81414
81431
|
return find(node.modifiers, isModifier);
|
|
81415
81432
|
default:
|