@typescript-deploys/pr-build 4.6.0-pr-47337-6 → 4.6.0-pr-47550-2
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 +57 -51
- package/lib/tsserver.js +71 -59
- package/lib/tsserverlibrary.js +71 -59
- package/lib/typescript.js +71 -59
- package/lib/typescriptServices.js +71 -59
- package/lib/typingsInstaller.js +71 -59
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -33355,7 +33355,7 @@ var ts;
|
|
|
33355
33355
|
function parseInitializer() {
|
|
33356
33356
|
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
33357
33357
|
}
|
|
33358
|
-
function parseAssignmentExpressionOrHigher() {
|
|
33358
|
+
function parseAssignmentExpressionOrHigher(parsingConditionalTrueSide) {
|
|
33359
33359
|
// AssignmentExpression[in,yield]:
|
|
33360
33360
|
// 1) ConditionalExpression[?in,?yield]
|
|
33361
33361
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -33381,7 +33381,7 @@ var ts;
|
|
|
33381
33381
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
33382
33382
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
33383
33383
|
// with AssignmentExpression if we see one.
|
|
33384
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
33384
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(parsingConditionalTrueSide) || tryParseAsyncSimpleArrowFunctionExpression();
|
|
33385
33385
|
if (arrowExpression) {
|
|
33386
33386
|
return arrowExpression;
|
|
33387
33387
|
}
|
|
@@ -33400,7 +33400,7 @@ var ts;
|
|
|
33400
33400
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
33401
33401
|
// identifier and the current token is an arrow.
|
|
33402
33402
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
33403
|
-
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
33403
|
+
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined, parsingConditionalTrueSide);
|
|
33404
33404
|
}
|
|
33405
33405
|
// Now see if we might be in cases '2' or '3'.
|
|
33406
33406
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -33460,7 +33460,7 @@ var ts;
|
|
|
33460
33460
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
33461
33461
|
}
|
|
33462
33462
|
}
|
|
33463
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
33463
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier, parsingConditionalTrueSide) {
|
|
33464
33464
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
33465
33465
|
var parameter = factory.createParameterDeclaration(
|
|
33466
33466
|
/*decorators*/ undefined,
|
|
@@ -33472,11 +33472,11 @@ var ts;
|
|
|
33472
33472
|
finishNode(parameter, identifier.pos);
|
|
33473
33473
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
33474
33474
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
33475
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
33475
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, parsingConditionalTrueSide);
|
|
33476
33476
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
33477
33477
|
return addJSDocComment(finishNode(node, pos));
|
|
33478
33478
|
}
|
|
33479
|
-
function tryParseParenthesizedArrowFunctionExpression() {
|
|
33479
|
+
function tryParseParenthesizedArrowFunctionExpression(parsingConditionalTrueSide) {
|
|
33480
33480
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
33481
33481
|
if (triState === 0 /* False */) {
|
|
33482
33482
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -33487,8 +33487,8 @@ var ts;
|
|
|
33487
33487
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
33488
33488
|
// expression instead.
|
|
33489
33489
|
return triState === 1 /* True */ ?
|
|
33490
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
33491
|
-
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
33490
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, parsingConditionalTrueSide) :
|
|
33491
|
+
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalTrueSide); });
|
|
33492
33492
|
}
|
|
33493
33493
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
33494
33494
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -33618,25 +33618,25 @@ var ts;
|
|
|
33618
33618
|
return 2 /* Unknown */;
|
|
33619
33619
|
}
|
|
33620
33620
|
}
|
|
33621
|
-
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
33621
|
+
function parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalTrueSide) {
|
|
33622
33622
|
var tokenPos = scanner.getTokenPos();
|
|
33623
33623
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
33624
33624
|
return undefined;
|
|
33625
33625
|
}
|
|
33626
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
33626
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, parsingConditionalTrueSide);
|
|
33627
33627
|
if (!result) {
|
|
33628
33628
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
33629
33629
|
}
|
|
33630
33630
|
return result;
|
|
33631
33631
|
}
|
|
33632
|
-
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
33632
|
+
function tryParseAsyncSimpleArrowFunctionExpression(parsingConditionalTrueSide) {
|
|
33633
33633
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
33634
33634
|
if (token() === 131 /* AsyncKeyword */) {
|
|
33635
33635
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
33636
33636
|
var pos = getNodePos();
|
|
33637
33637
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
33638
33638
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
33639
|
-
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
33639
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier, parsingConditionalTrueSide);
|
|
33640
33640
|
}
|
|
33641
33641
|
}
|
|
33642
33642
|
return undefined;
|
|
@@ -33660,7 +33660,7 @@ var ts;
|
|
|
33660
33660
|
}
|
|
33661
33661
|
return 0 /* False */;
|
|
33662
33662
|
}
|
|
33663
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
33663
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, parsingConditionalTrueSide) {
|
|
33664
33664
|
var pos = getNodePos();
|
|
33665
33665
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
33666
33666
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -33686,6 +33686,18 @@ var ts;
|
|
|
33686
33686
|
return undefined;
|
|
33687
33687
|
}
|
|
33688
33688
|
}
|
|
33689
|
+
// Given:
|
|
33690
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
33691
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
33692
|
+
// ({ y }) : z => ({ z })
|
|
33693
|
+
// This is a valid arrow function with "z" as the return type.
|
|
33694
|
+
//
|
|
33695
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
33696
|
+
// terminates the true side, so cannot be the return type.
|
|
33697
|
+
if (parsingConditionalTrueSide && token() === 58 /* ColonToken */) {
|
|
33698
|
+
ts.Debug.assert(!allowAmbiguity);
|
|
33699
|
+
return undefined;
|
|
33700
|
+
}
|
|
33689
33701
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
33690
33702
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
33691
33703
|
return undefined;
|
|
@@ -33719,7 +33731,7 @@ var ts;
|
|
|
33719
33731
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
33720
33732
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
33721
33733
|
}
|
|
33722
|
-
function parseArrowFunctionExpressionBody(isAsync) {
|
|
33734
|
+
function parseArrowFunctionExpressionBody(isAsync, parsingConditionalTrueSide) {
|
|
33723
33735
|
if (token() === 18 /* OpenBraceToken */) {
|
|
33724
33736
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
33725
33737
|
}
|
|
@@ -33747,8 +33759,8 @@ var ts;
|
|
|
33747
33759
|
var savedTopLevel = topLevel;
|
|
33748
33760
|
topLevel = false;
|
|
33749
33761
|
var node = isAsync
|
|
33750
|
-
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
33751
|
-
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
33762
|
+
? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalTrueSide); })
|
|
33763
|
+
: doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalTrueSide); });
|
|
33752
33764
|
topLevel = savedTopLevel;
|
|
33753
33765
|
return node;
|
|
33754
33766
|
}
|
|
@@ -33761,8 +33773,8 @@ var ts;
|
|
|
33761
33773
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
33762
33774
|
// we do not that for the 'whenFalse' part.
|
|
33763
33775
|
var colonToken;
|
|
33764
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
33765
|
-
? parseAssignmentExpressionOrHigher()
|
|
33776
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*parsingConditionalTrueSide*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
33777
|
+
? parseAssignmentExpressionOrHigher(/*parsingConditionalTrueSide*/ false)
|
|
33766
33778
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
33767
33779
|
}
|
|
33768
33780
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -46777,6 +46789,9 @@ var ts;
|
|
|
46777
46789
|
TypeFacts[TypeFacts["EmptyObjectStrictFacts"] = 16318463] = "EmptyObjectStrictFacts";
|
|
46778
46790
|
TypeFacts[TypeFacts["AllTypeofNE"] = 556800] = "AllTypeofNE";
|
|
46779
46791
|
TypeFacts[TypeFacts["EmptyObjectFacts"] = 16777215] = "EmptyObjectFacts";
|
|
46792
|
+
// Masks
|
|
46793
|
+
TypeFacts[TypeFacts["OrFactsMask"] = 8288] = "OrFactsMask";
|
|
46794
|
+
TypeFacts[TypeFacts["AndFactsMask"] = 16768927] = "AndFactsMask";
|
|
46780
46795
|
})(TypeFacts || (TypeFacts = {}));
|
|
46781
46796
|
var typeofEQFacts = new ts.Map(ts.getEntries({
|
|
46782
46797
|
string: 1 /* TypeofEQString */,
|
|
@@ -46817,10 +46832,6 @@ var ts;
|
|
|
46817
46832
|
CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
46818
46833
|
CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
46819
46834
|
CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
|
|
46820
|
-
CheckMode[CheckMode["ObjectRestBindingElement"] = 32] = "ObjectRestBindingElement";
|
|
46821
|
-
// e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
|
|
46822
|
-
// we need to preserve generic types instead of substituting them for constraints
|
|
46823
|
-
CheckMode[CheckMode["IncludeOptionality"] = 64] = "IncludeOptionality";
|
|
46824
46835
|
})(CheckMode || (CheckMode = {}));
|
|
46825
46836
|
var SignatureCheckMode;
|
|
46826
46837
|
(function (SignatureCheckMode) {
|
|
@@ -54245,12 +54256,9 @@ var ts;
|
|
|
54245
54256
|
}
|
|
54246
54257
|
// Return the type of a binding element parent. We check SymbolLinks first to see if a type has been
|
|
54247
54258
|
// assigned by contextual typing.
|
|
54248
|
-
function getTypeForBindingElementParent(node
|
|
54249
|
-
if (checkMode && checkMode !== 0 /* Normal */) {
|
|
54250
|
-
return getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false, checkMode);
|
|
54251
|
-
}
|
|
54259
|
+
function getTypeForBindingElementParent(node) {
|
|
54252
54260
|
var symbol = getSymbolOfNode(node);
|
|
54253
|
-
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false
|
|
54261
|
+
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
|
|
54254
54262
|
}
|
|
54255
54263
|
function getRestType(source, properties, symbol) {
|
|
54256
54264
|
source = filterType(source, function (t) { return !(t.flags & 98304 /* Nullable */); });
|
|
@@ -54368,8 +54376,7 @@ var ts;
|
|
|
54368
54376
|
}
|
|
54369
54377
|
/** Return the inferred type for a binding element */
|
|
54370
54378
|
function getTypeForBindingElement(declaration) {
|
|
54371
|
-
var
|
|
54372
|
-
var parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
54379
|
+
var parentType = getTypeForBindingElementParent(declaration.parent.parent);
|
|
54373
54380
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
54374
54381
|
}
|
|
54375
54382
|
function getBindingElementTypeFromParentType(declaration, parentType) {
|
|
@@ -54441,9 +54448,9 @@ var ts;
|
|
|
54441
54448
|
if (ts.getEffectiveTypeAnnotationNode(ts.walkUpBindingElementsAndPatterns(declaration))) {
|
|
54442
54449
|
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
|
|
54443
54450
|
// undefined from the final type.
|
|
54444
|
-
return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration
|
|
54451
|
+
return strictNullChecks && !(getFalsyFlags(checkDeclarationInitializer(declaration)) & 32768 /* Undefined */) ? getNonUndefinedType(type) : type;
|
|
54445
54452
|
}
|
|
54446
|
-
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration
|
|
54453
|
+
return widenTypeInferredFromInitializer(declaration, getUnionType([getNonUndefinedType(type), checkDeclarationInitializer(declaration)], 2 /* Subtype */));
|
|
54447
54454
|
}
|
|
54448
54455
|
function getTypeForDeclarationFromJSDocComment(declaration) {
|
|
54449
54456
|
var jsdocType = ts.getJSDocType(declaration);
|
|
@@ -54466,12 +54473,11 @@ var ts;
|
|
|
54466
54473
|
return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type;
|
|
54467
54474
|
}
|
|
54468
54475
|
// Return the inferred type for a variable, parameter, or property declaration
|
|
54469
|
-
function getTypeForVariableLikeDeclaration(declaration, includeOptionality
|
|
54470
|
-
checkMode) {
|
|
54476
|
+
function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
|
|
54471
54477
|
// A variable declared in a for..in statement is of type string, or of type keyof T when the
|
|
54472
54478
|
// right hand expression is of a type parameter type.
|
|
54473
54479
|
if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 242 /* ForInStatement */) {
|
|
54474
|
-
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression
|
|
54480
|
+
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
|
|
54475
54481
|
return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType;
|
|
54476
54482
|
}
|
|
54477
54483
|
if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* ForOfStatement */) {
|
|
@@ -54548,7 +54554,7 @@ var ts;
|
|
|
54548
54554
|
return containerObjectType;
|
|
54549
54555
|
}
|
|
54550
54556
|
}
|
|
54551
|
-
var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration
|
|
54557
|
+
var type = widenTypeInferredFromInitializer(declaration, checkDeclarationInitializer(declaration));
|
|
54552
54558
|
return addOptionality(type, isProperty, isOptional);
|
|
54553
54559
|
}
|
|
54554
54560
|
if (ts.isPropertyDeclaration(declaration) && (noImplicitAny || ts.isInJSFile(declaration))) {
|
|
@@ -54920,7 +54926,7 @@ var ts;
|
|
|
54920
54926
|
// contextual type or, if the element itself is a binding pattern, with the type implied by that binding
|
|
54921
54927
|
// pattern.
|
|
54922
54928
|
var contextualType = ts.isBindingPattern(element.name) ? getTypeFromBindingPattern(element.name, /*includePatternInType*/ true, /*reportErrors*/ false) : unknownType;
|
|
54923
|
-
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element,
|
|
54929
|
+
return addOptionality(widenTypeInferredFromInitializer(element, checkDeclarationInitializer(element, contextualType)));
|
|
54924
54930
|
}
|
|
54925
54931
|
if (ts.isBindingPattern(element.name)) {
|
|
54926
54932
|
return getTypeFromBindingPattern(element.name, includePatternInType, reportErrors);
|
|
@@ -55009,7 +55015,7 @@ var ts;
|
|
|
55009
55015
|
// binding pattern [x, s = ""]. Because the contextual type is a tuple type, the resulting type of [1, "one"] is the
|
|
55010
55016
|
// tuple type [number, string]. Thus, the type inferred for 'x' is number and the type inferred for 's' is string.
|
|
55011
55017
|
function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors) {
|
|
55012
|
-
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true
|
|
55018
|
+
return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true), declaration, reportErrors);
|
|
55013
55019
|
}
|
|
55014
55020
|
function isGlobalSymbolConstructor(node) {
|
|
55015
55021
|
var symbol = getSymbolOfNode(node);
|
|
@@ -67927,10 +67933,23 @@ var ts;
|
|
|
67927
67933
|
// When an intersection contains a primitive type we ignore object type constituents as they are
|
|
67928
67934
|
// presumably type tags. For example, in string & { __kind__: "name" } we ignore the object type.
|
|
67929
67935
|
ignoreObjects || (ignoreObjects = maybeTypeOfKind(type, 131068 /* Primitive */));
|
|
67930
|
-
return
|
|
67936
|
+
return getIntersectionTypeFacts(type, ignoreObjects);
|
|
67931
67937
|
}
|
|
67932
67938
|
return 16777215 /* All */;
|
|
67933
67939
|
}
|
|
67940
|
+
function getIntersectionTypeFacts(type, ignoreObjects) {
|
|
67941
|
+
// When computing the type facts of an intersection type, certain type facts are computed as `and`
|
|
67942
|
+
// and others are computed as `or`.
|
|
67943
|
+
var oredFacts = 0 /* None */;
|
|
67944
|
+
var andedFacts = 16777215 /* All */;
|
|
67945
|
+
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
|
67946
|
+
var t = _a[_i];
|
|
67947
|
+
var f = getTypeFacts(t, ignoreObjects);
|
|
67948
|
+
oredFacts |= f;
|
|
67949
|
+
andedFacts &= f;
|
|
67950
|
+
}
|
|
67951
|
+
return oredFacts & 8288 /* OrFactsMask */ | andedFacts & 16768927 /* AndFactsMask */;
|
|
67952
|
+
}
|
|
67934
67953
|
function getTypeWithFacts(type, include) {
|
|
67935
67954
|
return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
|
|
67936
67955
|
}
|
|
@@ -69755,16 +69774,12 @@ var ts;
|
|
|
69755
69774
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
69756
69775
|
return !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
69757
69776
|
}
|
|
69758
|
-
function
|
|
69777
|
+
function hasNonBindingPatternContextualTypeWithNoGenericTypes(node) {
|
|
69759
69778
|
// Computing the contextual type for a child of a JSX element involves resolving the type of the
|
|
69760
69779
|
// element's tag name, so we exclude that here to avoid circularities.
|
|
69761
|
-
// If check mode has `CheckMode.ObjectRestBindingElement`, we skip binding pattern contextual types,
|
|
69762
|
-
// as we want the type of a rest element to be generic when possible.
|
|
69763
69780
|
var contextualType = (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
|
|
69764
69781
|
!((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
|
|
69765
|
-
(
|
|
69766
|
-
getContextualType(node, 8 /* SkipBindingPatterns */)
|
|
69767
|
-
: getContextualType(node));
|
|
69782
|
+
getContextualType(node, 8 /* SkipBindingPatterns */);
|
|
69768
69783
|
return contextualType && !isGenericType(contextualType);
|
|
69769
69784
|
}
|
|
69770
69785
|
function getNarrowableTypeForReference(type, reference, checkMode) {
|
|
@@ -69777,7 +69792,7 @@ var ts;
|
|
|
69777
69792
|
// 'string | undefined' to give control flow analysis the opportunity to narrow to type 'string'.
|
|
69778
69793
|
var substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) &&
|
|
69779
69794
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
69780
|
-
(isConstraintPosition(type, reference) ||
|
|
69795
|
+
(isConstraintPosition(type, reference) || hasNonBindingPatternContextualTypeWithNoGenericTypes(reference));
|
|
69781
69796
|
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 /* Instantiable */ && !isMappedTypeGenericIndexedAccess(t) ? getBaseConstraintOrType(t) : t; }) : type;
|
|
69782
69797
|
}
|
|
69783
69798
|
function isExportOrExportExpression(location) {
|
|
@@ -69845,7 +69860,7 @@ var ts;
|
|
|
69845
69860
|
var links = getNodeLinks(location);
|
|
69846
69861
|
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
69847
69862
|
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
69848
|
-
var parentType = getTypeForBindingElementParent(parent
|
|
69863
|
+
var parentType = getTypeForBindingElementParent(parent);
|
|
69849
69864
|
links.flags &= ~268435456 /* InCheckIdentifier */;
|
|
69850
69865
|
if (parentType && parentType.flags & 1048576 /* Union */ && !(parent.kind === 163 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
69851
69866
|
var pattern = declaration.parent;
|
|
@@ -70695,7 +70710,7 @@ var ts;
|
|
|
70695
70710
|
var parent = declaration.parent.parent;
|
|
70696
70711
|
var name = declaration.propertyName || declaration.name;
|
|
70697
70712
|
var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
|
|
70698
|
-
parent.kind !== 202 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent
|
|
70713
|
+
parent.kind !== 202 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent);
|
|
70699
70714
|
if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
|
|
70700
70715
|
return undefined;
|
|
70701
70716
|
if (parent.name.kind === 201 /* ArrayBindingPattern */) {
|
|
@@ -75873,7 +75888,7 @@ var ts;
|
|
|
75873
75888
|
var links = getSymbolLinks(parameter);
|
|
75874
75889
|
if (!links.type) {
|
|
75875
75890
|
var declaration = parameter.valueDeclaration;
|
|
75876
|
-
links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*
|
|
75891
|
+
links.type = type || getWidenedTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ true);
|
|
75877
75892
|
if (declaration.name.kind !== 79 /* Identifier */) {
|
|
75878
75893
|
// if inference didn't come up with anything but unknown, fall back to the binding pattern if present.
|
|
75879
75894
|
if (links.type === unknownType) {
|
|
@@ -77604,11 +77619,11 @@ var ts;
|
|
|
77604
77619
|
}
|
|
77605
77620
|
}
|
|
77606
77621
|
function checkExpressionCached(node, checkMode) {
|
|
77607
|
-
if (checkMode && checkMode !== 0 /* Normal */) {
|
|
77608
|
-
return checkExpression(node, checkMode);
|
|
77609
|
-
}
|
|
77610
77622
|
var links = getNodeLinks(node);
|
|
77611
77623
|
if (!links.resolvedType) {
|
|
77624
|
+
if (checkMode && checkMode !== 0 /* Normal */) {
|
|
77625
|
+
return checkExpression(node, checkMode);
|
|
77626
|
+
}
|
|
77612
77627
|
// When computing a type that we're going to cache, we need to ignore any ongoing control flow
|
|
77613
77628
|
// analysis because variables may have transient types in indeterminable states. Moving flowLoopStart
|
|
77614
77629
|
// to the top of the stack ensures all transient types are computed from a known point.
|
|
@@ -77628,12 +77643,10 @@ var ts;
|
|
|
77628
77643
|
node.kind === 228 /* AsExpression */ ||
|
|
77629
77644
|
ts.isJSDocTypeAssertion(node);
|
|
77630
77645
|
}
|
|
77631
|
-
function checkDeclarationInitializer(declaration,
|
|
77646
|
+
function checkDeclarationInitializer(declaration, contextualType) {
|
|
77632
77647
|
var initializer = ts.getEffectiveInitializer(declaration);
|
|
77633
77648
|
var type = getQuickTypeOfExpression(initializer) ||
|
|
77634
|
-
(contextualType ?
|
|
77635
|
-
checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* Normal */)
|
|
77636
|
-
: checkExpressionCached(initializer, checkMode));
|
|
77649
|
+
(contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, 0 /* Normal */) : checkExpressionCached(initializer));
|
|
77637
77650
|
return ts.isParameter(declaration) && declaration.name.kind === 201 /* ArrayBindingPattern */ &&
|
|
77638
77651
|
isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ?
|
|
77639
77652
|
padTupleType(type, declaration.name) : type;
|
|
@@ -80573,8 +80586,7 @@ var ts;
|
|
|
80573
80586
|
}
|
|
80574
80587
|
// check private/protected variable access
|
|
80575
80588
|
var parent = node.parent.parent;
|
|
80576
|
-
var
|
|
80577
|
-
var parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
80589
|
+
var parentType = getTypeForBindingElementParent(parent);
|
|
80578
80590
|
var name = node.propertyName || node.name;
|
|
80579
80591
|
if (parentType && !ts.isBindingPattern(name)) {
|
|
80580
80592
|
var exprType = getLiteralTypeFromPropertyName(name);
|
|
@@ -81813,7 +81825,7 @@ var ts;
|
|
|
81813
81825
|
var declaration = catchClause.variableDeclaration;
|
|
81814
81826
|
var typeNode = ts.getEffectiveTypeAnnotationNode(ts.getRootDeclaration(declaration));
|
|
81815
81827
|
if (typeNode) {
|
|
81816
|
-
var type = getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ false
|
|
81828
|
+
var type = getTypeForVariableLikeDeclaration(declaration, /*includeOptionality*/ false);
|
|
81817
81829
|
if (type && !(type.flags & 3 /* AnyOrUnknown */)) {
|
|
81818
81830
|
grammarErrorOnFirstToken(typeNode, ts.Diagnostics.Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified);
|
|
81819
81831
|
}
|
|
@@ -84499,7 +84511,7 @@ var ts;
|
|
|
84499
84511
|
return errorType;
|
|
84500
84512
|
}
|
|
84501
84513
|
if (ts.isBindingPattern(node)) {
|
|
84502
|
-
return getTypeForVariableLikeDeclaration(node.parent, /*includeOptionality*/ true
|
|
84514
|
+
return getTypeForVariableLikeDeclaration(node.parent, /*includeOptionality*/ true) || errorType;
|
|
84503
84515
|
}
|
|
84504
84516
|
if (isInRightSideOfImportOrExportAssignment(node)) {
|
|
84505
84517
|
var symbol = getSymbolAtLocation(node);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.6.0-pr-
|
|
5
|
+
"version": "4.6.0-pr-47550-2",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|