@typescript-deploys/pr-build 4.7.0-pr-48788-2 → 4.7.0-pr-48792-5
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 +7 -10
- package/lib/tsserver.js +16 -29
- package/lib/tsserverlibrary.js +16 -29
- package/lib/typescript.js +16 -29
- package/lib/typescriptServices.js +16 -29
- package/lib/typingsInstaller.js +16 -29
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -27596,7 +27596,7 @@ var ts;
|
|
|
27596
27596
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
27597
27597
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
27598
27598
|
}
|
|
27599
|
-
return parseConditionalExpressionRest(expr, pos);
|
|
27599
|
+
return parseConditionalExpressionRest(expr, pos, disallowReturnTypeInArrowFunction);
|
|
27600
27600
|
}
|
|
27601
27601
|
function isYieldExpression() {
|
|
27602
27602
|
if (token() === 125) {
|
|
@@ -27638,7 +27638,7 @@ var ts;
|
|
|
27638
27638
|
return undefined;
|
|
27639
27639
|
}
|
|
27640
27640
|
return triState === 1 ?
|
|
27641
|
-
parseParenthesizedArrowFunctionExpression(true,
|
|
27641
|
+
parseParenthesizedArrowFunctionExpression(true, disallowReturnTypeInArrowFunction) :
|
|
27642
27642
|
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
27643
27643
|
}
|
|
27644
27644
|
function isParenthesizedArrowFunctionExpression() {
|
|
@@ -27796,7 +27796,9 @@ var ts;
|
|
|
27796
27796
|
return undefined;
|
|
27797
27797
|
}
|
|
27798
27798
|
}
|
|
27799
|
-
|
|
27799
|
+
if (disallowReturnTypeInArrowFunction && token() === 58) {
|
|
27800
|
+
return undefined;
|
|
27801
|
+
}
|
|
27800
27802
|
var type = parseReturnType(58, false);
|
|
27801
27803
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
27802
27804
|
return undefined;
|
|
@@ -27814,11 +27816,6 @@ var ts;
|
|
|
27814
27816
|
var body = (lastToken === 38 || lastToken === 18)
|
|
27815
27817
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
27816
27818
|
: parseIdentifier();
|
|
27817
|
-
if (disallowReturnTypeInArrowFunction && hasReturnColon) {
|
|
27818
|
-
if (token() !== 58) {
|
|
27819
|
-
return undefined;
|
|
27820
|
-
}
|
|
27821
|
-
}
|
|
27822
27819
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
27823
27820
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
27824
27821
|
}
|
|
@@ -27841,14 +27838,14 @@ var ts;
|
|
|
27841
27838
|
topLevel = savedTopLevel;
|
|
27842
27839
|
return node;
|
|
27843
27840
|
}
|
|
27844
|
-
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
27841
|
+
function parseConditionalExpressionRest(leftOperand, pos, disallowReturnTypeInArrowFunction) {
|
|
27845
27842
|
var questionToken = parseOptionalToken(57);
|
|
27846
27843
|
if (!questionToken) {
|
|
27847
27844
|
return leftOperand;
|
|
27848
27845
|
}
|
|
27849
27846
|
var colonToken;
|
|
27850
27847
|
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(true); }), colonToken = parseExpectedToken(58), ts.nodeIsPresent(colonToken)
|
|
27851
|
-
? parseAssignmentExpressionOrHigher(
|
|
27848
|
+
? parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction)
|
|
27852
27849
|
: createMissingNode(79, false, ts.Diagnostics._0_expected, ts.tokenToString(58))), pos);
|
|
27853
27850
|
}
|
|
27854
27851
|
function parseBinaryExpressionOrHigher(precedence) {
|
package/lib/tsserver.js
CHANGED
|
@@ -34223,7 +34223,7 @@ var ts;
|
|
|
34223
34223
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
34224
34224
|
}
|
|
34225
34225
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34226
|
-
return parseConditionalExpressionRest(expr, pos);
|
|
34226
|
+
return parseConditionalExpressionRest(expr, pos, disallowReturnTypeInArrowFunction);
|
|
34227
34227
|
}
|
|
34228
34228
|
function isYieldExpression() {
|
|
34229
34229
|
if (token() === 125 /* YieldKeyword */) {
|
|
@@ -34298,7 +34298,7 @@ var ts;
|
|
|
34298
34298
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34299
34299
|
// expression instead.
|
|
34300
34300
|
return triState === 1 /* True */ ?
|
|
34301
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true,
|
|
34301
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, disallowReturnTypeInArrowFunction) :
|
|
34302
34302
|
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
34303
34303
|
}
|
|
34304
34304
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
@@ -34506,7 +34506,18 @@ var ts;
|
|
|
34506
34506
|
return undefined;
|
|
34507
34507
|
}
|
|
34508
34508
|
}
|
|
34509
|
-
|
|
34509
|
+
// Given:
|
|
34510
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
34511
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
34512
|
+
// ({ y }) : z => ({ z })
|
|
34513
|
+
// This is a valid arrow function with "z" as the return type.
|
|
34514
|
+
//
|
|
34515
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
34516
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34517
|
+
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34518
|
+
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34519
|
+
return undefined;
|
|
34520
|
+
}
|
|
34510
34521
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34511
34522
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34512
34523
|
return undefined;
|
|
@@ -34537,30 +34548,6 @@ var ts;
|
|
|
34537
34548
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34538
34549
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
34539
34550
|
: parseIdentifier();
|
|
34540
|
-
// Given:
|
|
34541
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
34542
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
34543
|
-
// ({ y }) : z => ({ z })
|
|
34544
|
-
// This is a valid arrow function with "z" as the return type.
|
|
34545
|
-
//
|
|
34546
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
34547
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34548
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34549
|
-
//
|
|
34550
|
-
// For example,
|
|
34551
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34552
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34553
|
-
// be an arrow expression, so we allow a return type.
|
|
34554
|
-
if (disallowReturnTypeInArrowFunction && hasReturnColon) {
|
|
34555
|
-
// However, if the arrow function we were able to parse is followed by another colon
|
|
34556
|
-
// as in:
|
|
34557
|
-
// a ? (x): string => x : null
|
|
34558
|
-
// Then allow the arrow function, and treat the second colon as terminating
|
|
34559
|
-
// the conditional expression.
|
|
34560
|
-
if (token() !== 58 /* ColonToken */) {
|
|
34561
|
-
return undefined;
|
|
34562
|
-
}
|
|
34563
|
-
}
|
|
34564
34551
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34565
34552
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34566
34553
|
}
|
|
@@ -34597,7 +34584,7 @@ var ts;
|
|
|
34597
34584
|
topLevel = savedTopLevel;
|
|
34598
34585
|
return node;
|
|
34599
34586
|
}
|
|
34600
|
-
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
34587
|
+
function parseConditionalExpressionRest(leftOperand, pos, disallowReturnTypeInArrowFunction) {
|
|
34601
34588
|
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
|
|
34602
34589
|
var questionToken = parseOptionalToken(57 /* QuestionToken */);
|
|
34603
34590
|
if (!questionToken) {
|
|
@@ -34607,7 +34594,7 @@ var ts;
|
|
|
34607
34594
|
// we do not that for the 'whenFalse' part.
|
|
34608
34595
|
var colonToken;
|
|
34609
34596
|
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34610
|
-
? parseAssignmentExpressionOrHigher(
|
|
34597
|
+
? parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) // inherit disallowReturnTypeInArrowFunction in false side
|
|
34611
34598
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34612
34599
|
}
|
|
34613
34600
|
function parseBinaryExpressionOrHigher(precedence) {
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -34417,7 +34417,7 @@ var ts;
|
|
|
34417
34417
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
34418
34418
|
}
|
|
34419
34419
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34420
|
-
return parseConditionalExpressionRest(expr, pos);
|
|
34420
|
+
return parseConditionalExpressionRest(expr, pos, disallowReturnTypeInArrowFunction);
|
|
34421
34421
|
}
|
|
34422
34422
|
function isYieldExpression() {
|
|
34423
34423
|
if (token() === 125 /* YieldKeyword */) {
|
|
@@ -34492,7 +34492,7 @@ var ts;
|
|
|
34492
34492
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34493
34493
|
// expression instead.
|
|
34494
34494
|
return triState === 1 /* True */ ?
|
|
34495
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true,
|
|
34495
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, disallowReturnTypeInArrowFunction) :
|
|
34496
34496
|
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
34497
34497
|
}
|
|
34498
34498
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
@@ -34700,7 +34700,18 @@ var ts;
|
|
|
34700
34700
|
return undefined;
|
|
34701
34701
|
}
|
|
34702
34702
|
}
|
|
34703
|
-
|
|
34703
|
+
// Given:
|
|
34704
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
34705
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
34706
|
+
// ({ y }) : z => ({ z })
|
|
34707
|
+
// This is a valid arrow function with "z" as the return type.
|
|
34708
|
+
//
|
|
34709
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
34710
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34711
|
+
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34712
|
+
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34713
|
+
return undefined;
|
|
34714
|
+
}
|
|
34704
34715
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34705
34716
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34706
34717
|
return undefined;
|
|
@@ -34731,30 +34742,6 @@ var ts;
|
|
|
34731
34742
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34732
34743
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
34733
34744
|
: parseIdentifier();
|
|
34734
|
-
// Given:
|
|
34735
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
34736
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
34737
|
-
// ({ y }) : z => ({ z })
|
|
34738
|
-
// This is a valid arrow function with "z" as the return type.
|
|
34739
|
-
//
|
|
34740
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
34741
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34742
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34743
|
-
//
|
|
34744
|
-
// For example,
|
|
34745
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34746
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34747
|
-
// be an arrow expression, so we allow a return type.
|
|
34748
|
-
if (disallowReturnTypeInArrowFunction && hasReturnColon) {
|
|
34749
|
-
// However, if the arrow function we were able to parse is followed by another colon
|
|
34750
|
-
// as in:
|
|
34751
|
-
// a ? (x): string => x : null
|
|
34752
|
-
// Then allow the arrow function, and treat the second colon as terminating
|
|
34753
|
-
// the conditional expression.
|
|
34754
|
-
if (token() !== 58 /* ColonToken */) {
|
|
34755
|
-
return undefined;
|
|
34756
|
-
}
|
|
34757
|
-
}
|
|
34758
34745
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34759
34746
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34760
34747
|
}
|
|
@@ -34791,7 +34778,7 @@ var ts;
|
|
|
34791
34778
|
topLevel = savedTopLevel;
|
|
34792
34779
|
return node;
|
|
34793
34780
|
}
|
|
34794
|
-
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
34781
|
+
function parseConditionalExpressionRest(leftOperand, pos, disallowReturnTypeInArrowFunction) {
|
|
34795
34782
|
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
|
|
34796
34783
|
var questionToken = parseOptionalToken(57 /* QuestionToken */);
|
|
34797
34784
|
if (!questionToken) {
|
|
@@ -34801,7 +34788,7 @@ var ts;
|
|
|
34801
34788
|
// we do not that for the 'whenFalse' part.
|
|
34802
34789
|
var colonToken;
|
|
34803
34790
|
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34804
|
-
? parseAssignmentExpressionOrHigher(
|
|
34791
|
+
? parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) // inherit disallowReturnTypeInArrowFunction in false side
|
|
34805
34792
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34806
34793
|
}
|
|
34807
34794
|
function parseBinaryExpressionOrHigher(precedence) {
|
package/lib/typescript.js
CHANGED
|
@@ -34417,7 +34417,7 @@ var ts;
|
|
|
34417
34417
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
34418
34418
|
}
|
|
34419
34419
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34420
|
-
return parseConditionalExpressionRest(expr, pos);
|
|
34420
|
+
return parseConditionalExpressionRest(expr, pos, disallowReturnTypeInArrowFunction);
|
|
34421
34421
|
}
|
|
34422
34422
|
function isYieldExpression() {
|
|
34423
34423
|
if (token() === 125 /* YieldKeyword */) {
|
|
@@ -34492,7 +34492,7 @@ var ts;
|
|
|
34492
34492
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34493
34493
|
// expression instead.
|
|
34494
34494
|
return triState === 1 /* True */ ?
|
|
34495
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true,
|
|
34495
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, disallowReturnTypeInArrowFunction) :
|
|
34496
34496
|
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
34497
34497
|
}
|
|
34498
34498
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
@@ -34700,7 +34700,18 @@ var ts;
|
|
|
34700
34700
|
return undefined;
|
|
34701
34701
|
}
|
|
34702
34702
|
}
|
|
34703
|
-
|
|
34703
|
+
// Given:
|
|
34704
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
34705
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
34706
|
+
// ({ y }) : z => ({ z })
|
|
34707
|
+
// This is a valid arrow function with "z" as the return type.
|
|
34708
|
+
//
|
|
34709
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
34710
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34711
|
+
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34712
|
+
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34713
|
+
return undefined;
|
|
34714
|
+
}
|
|
34704
34715
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34705
34716
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34706
34717
|
return undefined;
|
|
@@ -34731,30 +34742,6 @@ var ts;
|
|
|
34731
34742
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34732
34743
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
34733
34744
|
: parseIdentifier();
|
|
34734
|
-
// Given:
|
|
34735
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
34736
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
34737
|
-
// ({ y }) : z => ({ z })
|
|
34738
|
-
// This is a valid arrow function with "z" as the return type.
|
|
34739
|
-
//
|
|
34740
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
34741
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34742
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34743
|
-
//
|
|
34744
|
-
// For example,
|
|
34745
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34746
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34747
|
-
// be an arrow expression, so we allow a return type.
|
|
34748
|
-
if (disallowReturnTypeInArrowFunction && hasReturnColon) {
|
|
34749
|
-
// However, if the arrow function we were able to parse is followed by another colon
|
|
34750
|
-
// as in:
|
|
34751
|
-
// a ? (x): string => x : null
|
|
34752
|
-
// Then allow the arrow function, and treat the second colon as terminating
|
|
34753
|
-
// the conditional expression.
|
|
34754
|
-
if (token() !== 58 /* ColonToken */) {
|
|
34755
|
-
return undefined;
|
|
34756
|
-
}
|
|
34757
|
-
}
|
|
34758
34745
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34759
34746
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34760
34747
|
}
|
|
@@ -34791,7 +34778,7 @@ var ts;
|
|
|
34791
34778
|
topLevel = savedTopLevel;
|
|
34792
34779
|
return node;
|
|
34793
34780
|
}
|
|
34794
|
-
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
34781
|
+
function parseConditionalExpressionRest(leftOperand, pos, disallowReturnTypeInArrowFunction) {
|
|
34795
34782
|
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
|
|
34796
34783
|
var questionToken = parseOptionalToken(57 /* QuestionToken */);
|
|
34797
34784
|
if (!questionToken) {
|
|
@@ -34801,7 +34788,7 @@ var ts;
|
|
|
34801
34788
|
// we do not that for the 'whenFalse' part.
|
|
34802
34789
|
var colonToken;
|
|
34803
34790
|
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34804
|
-
? parseAssignmentExpressionOrHigher(
|
|
34791
|
+
? parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) // inherit disallowReturnTypeInArrowFunction in false side
|
|
34805
34792
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34806
34793
|
}
|
|
34807
34794
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -34417,7 +34417,7 @@ var ts;
|
|
|
34417
34417
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
34418
34418
|
}
|
|
34419
34419
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34420
|
-
return parseConditionalExpressionRest(expr, pos);
|
|
34420
|
+
return parseConditionalExpressionRest(expr, pos, disallowReturnTypeInArrowFunction);
|
|
34421
34421
|
}
|
|
34422
34422
|
function isYieldExpression() {
|
|
34423
34423
|
if (token() === 125 /* YieldKeyword */) {
|
|
@@ -34492,7 +34492,7 @@ var ts;
|
|
|
34492
34492
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34493
34493
|
// expression instead.
|
|
34494
34494
|
return triState === 1 /* True */ ?
|
|
34495
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true,
|
|
34495
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, disallowReturnTypeInArrowFunction) :
|
|
34496
34496
|
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
34497
34497
|
}
|
|
34498
34498
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
@@ -34700,7 +34700,18 @@ var ts;
|
|
|
34700
34700
|
return undefined;
|
|
34701
34701
|
}
|
|
34702
34702
|
}
|
|
34703
|
-
|
|
34703
|
+
// Given:
|
|
34704
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
34705
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
34706
|
+
// ({ y }) : z => ({ z })
|
|
34707
|
+
// This is a valid arrow function with "z" as the return type.
|
|
34708
|
+
//
|
|
34709
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
34710
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34711
|
+
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34712
|
+
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34713
|
+
return undefined;
|
|
34714
|
+
}
|
|
34704
34715
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34705
34716
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34706
34717
|
return undefined;
|
|
@@ -34731,30 +34742,6 @@ var ts;
|
|
|
34731
34742
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34732
34743
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
34733
34744
|
: parseIdentifier();
|
|
34734
|
-
// Given:
|
|
34735
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
34736
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
34737
|
-
// ({ y }) : z => ({ z })
|
|
34738
|
-
// This is a valid arrow function with "z" as the return type.
|
|
34739
|
-
//
|
|
34740
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
34741
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34742
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34743
|
-
//
|
|
34744
|
-
// For example,
|
|
34745
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34746
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34747
|
-
// be an arrow expression, so we allow a return type.
|
|
34748
|
-
if (disallowReturnTypeInArrowFunction && hasReturnColon) {
|
|
34749
|
-
// However, if the arrow function we were able to parse is followed by another colon
|
|
34750
|
-
// as in:
|
|
34751
|
-
// a ? (x): string => x : null
|
|
34752
|
-
// Then allow the arrow function, and treat the second colon as terminating
|
|
34753
|
-
// the conditional expression.
|
|
34754
|
-
if (token() !== 58 /* ColonToken */) {
|
|
34755
|
-
return undefined;
|
|
34756
|
-
}
|
|
34757
|
-
}
|
|
34758
34745
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34759
34746
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34760
34747
|
}
|
|
@@ -34791,7 +34778,7 @@ var ts;
|
|
|
34791
34778
|
topLevel = savedTopLevel;
|
|
34792
34779
|
return node;
|
|
34793
34780
|
}
|
|
34794
|
-
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
34781
|
+
function parseConditionalExpressionRest(leftOperand, pos, disallowReturnTypeInArrowFunction) {
|
|
34795
34782
|
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
|
|
34796
34783
|
var questionToken = parseOptionalToken(57 /* QuestionToken */);
|
|
34797
34784
|
if (!questionToken) {
|
|
@@ -34801,7 +34788,7 @@ var ts;
|
|
|
34801
34788
|
// we do not that for the 'whenFalse' part.
|
|
34802
34789
|
var colonToken;
|
|
34803
34790
|
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34804
|
-
? parseAssignmentExpressionOrHigher(
|
|
34791
|
+
? parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) // inherit disallowReturnTypeInArrowFunction in false side
|
|
34805
34792
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34806
34793
|
}
|
|
34807
34794
|
function parseBinaryExpressionOrHigher(precedence) {
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -34212,7 +34212,7 @@ var ts;
|
|
|
34212
34212
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction), pos);
|
|
34213
34213
|
}
|
|
34214
34214
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34215
|
-
return parseConditionalExpressionRest(expr, pos);
|
|
34215
|
+
return parseConditionalExpressionRest(expr, pos, disallowReturnTypeInArrowFunction);
|
|
34216
34216
|
}
|
|
34217
34217
|
function isYieldExpression() {
|
|
34218
34218
|
if (token() === 125 /* YieldKeyword */) {
|
|
@@ -34287,7 +34287,7 @@ var ts;
|
|
|
34287
34287
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34288
34288
|
// expression instead.
|
|
34289
34289
|
return triState === 1 /* True */ ?
|
|
34290
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true,
|
|
34290
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, disallowReturnTypeInArrowFunction) :
|
|
34291
34291
|
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction); });
|
|
34292
34292
|
}
|
|
34293
34293
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
@@ -34495,7 +34495,18 @@ var ts;
|
|
|
34495
34495
|
return undefined;
|
|
34496
34496
|
}
|
|
34497
34497
|
}
|
|
34498
|
-
|
|
34498
|
+
// Given:
|
|
34499
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
34500
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
34501
|
+
// ({ y }) : z => ({ z })
|
|
34502
|
+
// This is a valid arrow function with "z" as the return type.
|
|
34503
|
+
//
|
|
34504
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
34505
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34506
|
+
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34507
|
+
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34508
|
+
return undefined;
|
|
34509
|
+
}
|
|
34499
34510
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34500
34511
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34501
34512
|
return undefined;
|
|
@@ -34526,30 +34537,6 @@ var ts;
|
|
|
34526
34537
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34527
34538
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
34528
34539
|
: parseIdentifier();
|
|
34529
|
-
// Given:
|
|
34530
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
34531
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
34532
|
-
// ({ y }) : z => ({ z })
|
|
34533
|
-
// This is a valid arrow function with "z" as the return type.
|
|
34534
|
-
//
|
|
34535
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
34536
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34537
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34538
|
-
//
|
|
34539
|
-
// For example,
|
|
34540
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34541
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34542
|
-
// be an arrow expression, so we allow a return type.
|
|
34543
|
-
if (disallowReturnTypeInArrowFunction && hasReturnColon) {
|
|
34544
|
-
// However, if the arrow function we were able to parse is followed by another colon
|
|
34545
|
-
// as in:
|
|
34546
|
-
// a ? (x): string => x : null
|
|
34547
|
-
// Then allow the arrow function, and treat the second colon as terminating
|
|
34548
|
-
// the conditional expression.
|
|
34549
|
-
if (token() !== 58 /* ColonToken */) {
|
|
34550
|
-
return undefined;
|
|
34551
|
-
}
|
|
34552
|
-
}
|
|
34553
34540
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34554
34541
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34555
34542
|
}
|
|
@@ -34586,7 +34573,7 @@ var ts;
|
|
|
34586
34573
|
topLevel = savedTopLevel;
|
|
34587
34574
|
return node;
|
|
34588
34575
|
}
|
|
34589
|
-
function parseConditionalExpressionRest(leftOperand, pos) {
|
|
34576
|
+
function parseConditionalExpressionRest(leftOperand, pos, disallowReturnTypeInArrowFunction) {
|
|
34590
34577
|
// Note: we are passed in an expression which was produced from parseBinaryExpressionOrHigher.
|
|
34591
34578
|
var questionToken = parseOptionalToken(57 /* QuestionToken */);
|
|
34592
34579
|
if (!questionToken) {
|
|
@@ -34596,7 +34583,7 @@ var ts;
|
|
|
34596
34583
|
// we do not that for the 'whenFalse' part.
|
|
34597
34584
|
var colonToken;
|
|
34598
34585
|
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*disallowReturnTypeInArrowFunction*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34599
|
-
? parseAssignmentExpressionOrHigher(
|
|
34586
|
+
? parseAssignmentExpressionOrHigher(disallowReturnTypeInArrowFunction) // inherit disallowReturnTypeInArrowFunction in false side
|
|
34600
34587
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34601
34588
|
}
|
|
34602
34589
|
function parseBinaryExpressionOrHigher(precedence) {
|
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.7.0-pr-
|
|
5
|
+
"version": "4.7.0-pr-48792-5",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|