@typescript-deploys/pr-build 4.7.0-pr-48788-2 → 4.7.0-pr-48791-4
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 +13 -12
- package/lib/tsserver.js +23 -31
- package/lib/tsserverlibrary.js +23 -31
- package/lib/typescript.js +23 -31
- package/lib/typescriptServices.js +23 -31
- package/lib/typingsInstaller.js +23 -31
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -27633,24 +27633,24 @@ var ts;
|
|
|
27633
27633
|
return addJSDocComment(finishNode(node, pos));
|
|
27634
27634
|
}
|
|
27635
27635
|
function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
27636
|
-
var triState = isParenthesizedArrowFunctionExpression();
|
|
27636
|
+
var triState = isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction);
|
|
27637
27637
|
if (triState === 0) {
|
|
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
|
-
function isParenthesizedArrowFunctionExpression() {
|
|
27644
|
+
function isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
27645
27645
|
if (token() === 20 || token() === 29 || token() === 131) {
|
|
27646
|
-
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
|
|
27646
|
+
return lookAhead(function () { return isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction); });
|
|
27647
27647
|
}
|
|
27648
27648
|
if (token() === 38) {
|
|
27649
27649
|
return 1;
|
|
27650
27650
|
}
|
|
27651
27651
|
return 0;
|
|
27652
27652
|
}
|
|
27653
|
-
function isParenthesizedArrowFunctionExpressionWorker() {
|
|
27653
|
+
function isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction) {
|
|
27654
27654
|
if (token() === 131) {
|
|
27655
27655
|
nextToken();
|
|
27656
27656
|
if (scanner.hasPrecedingLineBreak()) {
|
|
@@ -27666,8 +27666,12 @@ var ts;
|
|
|
27666
27666
|
if (second === 21) {
|
|
27667
27667
|
var third = nextToken();
|
|
27668
27668
|
switch (third) {
|
|
27669
|
-
case 38:
|
|
27670
27669
|
case 58:
|
|
27670
|
+
if (disallowReturnTypeInArrowFunction) {
|
|
27671
|
+
return 0;
|
|
27672
|
+
}
|
|
27673
|
+
return 1;
|
|
27674
|
+
case 38:
|
|
27671
27675
|
case 18:
|
|
27672
27676
|
return 1;
|
|
27673
27677
|
default:
|
|
@@ -27796,7 +27800,9 @@ var ts;
|
|
|
27796
27800
|
return undefined;
|
|
27797
27801
|
}
|
|
27798
27802
|
}
|
|
27799
|
-
|
|
27803
|
+
if (disallowReturnTypeInArrowFunction && token() === 58) {
|
|
27804
|
+
return undefined;
|
|
27805
|
+
}
|
|
27800
27806
|
var type = parseReturnType(58, false);
|
|
27801
27807
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
27802
27808
|
return undefined;
|
|
@@ -27814,11 +27820,6 @@ var ts;
|
|
|
27814
27820
|
var body = (lastToken === 38 || lastToken === 18)
|
|
27815
27821
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
27816
27822
|
: parseIdentifier();
|
|
27817
|
-
if (disallowReturnTypeInArrowFunction && hasReturnColon) {
|
|
27818
|
-
if (token() !== 58) {
|
|
27819
|
-
return undefined;
|
|
27820
|
-
}
|
|
27821
|
-
}
|
|
27822
27823
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
27823
27824
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
27824
27825
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -34288,7 +34288,7 @@ var ts;
|
|
|
34288
34288
|
return addJSDocComment(finishNode(node, pos));
|
|
34289
34289
|
}
|
|
34290
34290
|
function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34291
|
-
var triState = isParenthesizedArrowFunctionExpression();
|
|
34291
|
+
var triState = isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction);
|
|
34292
34292
|
if (triState === 0 /* False */) {
|
|
34293
34293
|
// It's definitely not a parenthesized arrow function expression.
|
|
34294
34294
|
return undefined;
|
|
@@ -34298,16 +34298,16 @@ 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.
|
|
34305
34305
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
34306
34306
|
// Unknown -> There *might* be a parenthesized arrow function here.
|
|
34307
34307
|
// Speculatively look ahead to be sure, and rollback if not.
|
|
34308
|
-
function isParenthesizedArrowFunctionExpression() {
|
|
34308
|
+
function isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34309
34309
|
if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */ || token() === 131 /* AsyncKeyword */) {
|
|
34310
|
-
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
|
|
34310
|
+
return lookAhead(function () { return isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction); });
|
|
34311
34311
|
}
|
|
34312
34312
|
if (token() === 38 /* EqualsGreaterThanToken */) {
|
|
34313
34313
|
// ERROR RECOVERY TWEAK:
|
|
@@ -34318,7 +34318,7 @@ var ts;
|
|
|
34318
34318
|
// Definitely not a parenthesized arrow function.
|
|
34319
34319
|
return 0 /* False */;
|
|
34320
34320
|
}
|
|
34321
|
-
function isParenthesizedArrowFunctionExpressionWorker() {
|
|
34321
|
+
function isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction) {
|
|
34322
34322
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34323
34323
|
nextToken();
|
|
34324
34324
|
if (scanner.hasPrecedingLineBreak()) {
|
|
@@ -34338,8 +34338,13 @@ var ts;
|
|
|
34338
34338
|
// but this is probably what the user intended.
|
|
34339
34339
|
var third = nextToken();
|
|
34340
34340
|
switch (third) {
|
|
34341
|
-
case 38 /* EqualsGreaterThanToken */:
|
|
34342
34341
|
case 58 /* ColonToken */:
|
|
34342
|
+
if (disallowReturnTypeInArrowFunction) {
|
|
34343
|
+
// "a ? () : ..."
|
|
34344
|
+
return 0 /* False */;
|
|
34345
|
+
}
|
|
34346
|
+
return 1 /* True */;
|
|
34347
|
+
case 38 /* EqualsGreaterThanToken */:
|
|
34343
34348
|
case 18 /* OpenBraceToken */:
|
|
34344
34349
|
return 1 /* True */;
|
|
34345
34350
|
default:
|
|
@@ -34506,7 +34511,18 @@ var ts;
|
|
|
34506
34511
|
return undefined;
|
|
34507
34512
|
}
|
|
34508
34513
|
}
|
|
34509
|
-
|
|
34514
|
+
// Given:
|
|
34515
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
34516
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
34517
|
+
// ({ y }) : z => ({ z })
|
|
34518
|
+
// This is a valid arrow function with "z" as the return type.
|
|
34519
|
+
//
|
|
34520
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
34521
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34522
|
+
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34523
|
+
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34524
|
+
return undefined;
|
|
34525
|
+
}
|
|
34510
34526
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34511
34527
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34512
34528
|
return undefined;
|
|
@@ -34537,30 +34553,6 @@ var ts;
|
|
|
34537
34553
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34538
34554
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
34539
34555
|
: 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
34556
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34565
34557
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34566
34558
|
}
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -34482,7 +34482,7 @@ var ts;
|
|
|
34482
34482
|
return addJSDocComment(finishNode(node, pos));
|
|
34483
34483
|
}
|
|
34484
34484
|
function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34485
|
-
var triState = isParenthesizedArrowFunctionExpression();
|
|
34485
|
+
var triState = isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction);
|
|
34486
34486
|
if (triState === 0 /* False */) {
|
|
34487
34487
|
// It's definitely not a parenthesized arrow function expression.
|
|
34488
34488
|
return undefined;
|
|
@@ -34492,16 +34492,16 @@ 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.
|
|
34499
34499
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
34500
34500
|
// Unknown -> There *might* be a parenthesized arrow function here.
|
|
34501
34501
|
// Speculatively look ahead to be sure, and rollback if not.
|
|
34502
|
-
function isParenthesizedArrowFunctionExpression() {
|
|
34502
|
+
function isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34503
34503
|
if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */ || token() === 131 /* AsyncKeyword */) {
|
|
34504
|
-
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
|
|
34504
|
+
return lookAhead(function () { return isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction); });
|
|
34505
34505
|
}
|
|
34506
34506
|
if (token() === 38 /* EqualsGreaterThanToken */) {
|
|
34507
34507
|
// ERROR RECOVERY TWEAK:
|
|
@@ -34512,7 +34512,7 @@ var ts;
|
|
|
34512
34512
|
// Definitely not a parenthesized arrow function.
|
|
34513
34513
|
return 0 /* False */;
|
|
34514
34514
|
}
|
|
34515
|
-
function isParenthesizedArrowFunctionExpressionWorker() {
|
|
34515
|
+
function isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction) {
|
|
34516
34516
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34517
34517
|
nextToken();
|
|
34518
34518
|
if (scanner.hasPrecedingLineBreak()) {
|
|
@@ -34532,8 +34532,13 @@ var ts;
|
|
|
34532
34532
|
// but this is probably what the user intended.
|
|
34533
34533
|
var third = nextToken();
|
|
34534
34534
|
switch (third) {
|
|
34535
|
-
case 38 /* EqualsGreaterThanToken */:
|
|
34536
34535
|
case 58 /* ColonToken */:
|
|
34536
|
+
if (disallowReturnTypeInArrowFunction) {
|
|
34537
|
+
// "a ? () : ..."
|
|
34538
|
+
return 0 /* False */;
|
|
34539
|
+
}
|
|
34540
|
+
return 1 /* True */;
|
|
34541
|
+
case 38 /* EqualsGreaterThanToken */:
|
|
34537
34542
|
case 18 /* OpenBraceToken */:
|
|
34538
34543
|
return 1 /* True */;
|
|
34539
34544
|
default:
|
|
@@ -34700,7 +34705,18 @@ var ts;
|
|
|
34700
34705
|
return undefined;
|
|
34701
34706
|
}
|
|
34702
34707
|
}
|
|
34703
|
-
|
|
34708
|
+
// Given:
|
|
34709
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
34710
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
34711
|
+
// ({ y }) : z => ({ z })
|
|
34712
|
+
// This is a valid arrow function with "z" as the return type.
|
|
34713
|
+
//
|
|
34714
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
34715
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34716
|
+
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34717
|
+
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34718
|
+
return undefined;
|
|
34719
|
+
}
|
|
34704
34720
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34705
34721
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34706
34722
|
return undefined;
|
|
@@ -34731,30 +34747,6 @@ var ts;
|
|
|
34731
34747
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34732
34748
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
34733
34749
|
: 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
34750
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34759
34751
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34760
34752
|
}
|
package/lib/typescript.js
CHANGED
|
@@ -34482,7 +34482,7 @@ var ts;
|
|
|
34482
34482
|
return addJSDocComment(finishNode(node, pos));
|
|
34483
34483
|
}
|
|
34484
34484
|
function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34485
|
-
var triState = isParenthesizedArrowFunctionExpression();
|
|
34485
|
+
var triState = isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction);
|
|
34486
34486
|
if (triState === 0 /* False */) {
|
|
34487
34487
|
// It's definitely not a parenthesized arrow function expression.
|
|
34488
34488
|
return undefined;
|
|
@@ -34492,16 +34492,16 @@ 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.
|
|
34499
34499
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
34500
34500
|
// Unknown -> There *might* be a parenthesized arrow function here.
|
|
34501
34501
|
// Speculatively look ahead to be sure, and rollback if not.
|
|
34502
|
-
function isParenthesizedArrowFunctionExpression() {
|
|
34502
|
+
function isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34503
34503
|
if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */ || token() === 131 /* AsyncKeyword */) {
|
|
34504
|
-
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
|
|
34504
|
+
return lookAhead(function () { return isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction); });
|
|
34505
34505
|
}
|
|
34506
34506
|
if (token() === 38 /* EqualsGreaterThanToken */) {
|
|
34507
34507
|
// ERROR RECOVERY TWEAK:
|
|
@@ -34512,7 +34512,7 @@ var ts;
|
|
|
34512
34512
|
// Definitely not a parenthesized arrow function.
|
|
34513
34513
|
return 0 /* False */;
|
|
34514
34514
|
}
|
|
34515
|
-
function isParenthesizedArrowFunctionExpressionWorker() {
|
|
34515
|
+
function isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction) {
|
|
34516
34516
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34517
34517
|
nextToken();
|
|
34518
34518
|
if (scanner.hasPrecedingLineBreak()) {
|
|
@@ -34532,8 +34532,13 @@ var ts;
|
|
|
34532
34532
|
// but this is probably what the user intended.
|
|
34533
34533
|
var third = nextToken();
|
|
34534
34534
|
switch (third) {
|
|
34535
|
-
case 38 /* EqualsGreaterThanToken */:
|
|
34536
34535
|
case 58 /* ColonToken */:
|
|
34536
|
+
if (disallowReturnTypeInArrowFunction) {
|
|
34537
|
+
// "a ? () : ..."
|
|
34538
|
+
return 0 /* False */;
|
|
34539
|
+
}
|
|
34540
|
+
return 1 /* True */;
|
|
34541
|
+
case 38 /* EqualsGreaterThanToken */:
|
|
34537
34542
|
case 18 /* OpenBraceToken */:
|
|
34538
34543
|
return 1 /* True */;
|
|
34539
34544
|
default:
|
|
@@ -34700,7 +34705,18 @@ var ts;
|
|
|
34700
34705
|
return undefined;
|
|
34701
34706
|
}
|
|
34702
34707
|
}
|
|
34703
|
-
|
|
34708
|
+
// Given:
|
|
34709
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
34710
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
34711
|
+
// ({ y }) : z => ({ z })
|
|
34712
|
+
// This is a valid arrow function with "z" as the return type.
|
|
34713
|
+
//
|
|
34714
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
34715
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34716
|
+
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34717
|
+
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34718
|
+
return undefined;
|
|
34719
|
+
}
|
|
34704
34720
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34705
34721
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34706
34722
|
return undefined;
|
|
@@ -34731,30 +34747,6 @@ var ts;
|
|
|
34731
34747
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34732
34748
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
34733
34749
|
: 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
34750
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34759
34751
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34760
34752
|
}
|
|
@@ -34482,7 +34482,7 @@ var ts;
|
|
|
34482
34482
|
return addJSDocComment(finishNode(node, pos));
|
|
34483
34483
|
}
|
|
34484
34484
|
function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34485
|
-
var triState = isParenthesizedArrowFunctionExpression();
|
|
34485
|
+
var triState = isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction);
|
|
34486
34486
|
if (triState === 0 /* False */) {
|
|
34487
34487
|
// It's definitely not a parenthesized arrow function expression.
|
|
34488
34488
|
return undefined;
|
|
@@ -34492,16 +34492,16 @@ 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.
|
|
34499
34499
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
34500
34500
|
// Unknown -> There *might* be a parenthesized arrow function here.
|
|
34501
34501
|
// Speculatively look ahead to be sure, and rollback if not.
|
|
34502
|
-
function isParenthesizedArrowFunctionExpression() {
|
|
34502
|
+
function isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34503
34503
|
if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */ || token() === 131 /* AsyncKeyword */) {
|
|
34504
|
-
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
|
|
34504
|
+
return lookAhead(function () { return isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction); });
|
|
34505
34505
|
}
|
|
34506
34506
|
if (token() === 38 /* EqualsGreaterThanToken */) {
|
|
34507
34507
|
// ERROR RECOVERY TWEAK:
|
|
@@ -34512,7 +34512,7 @@ var ts;
|
|
|
34512
34512
|
// Definitely not a parenthesized arrow function.
|
|
34513
34513
|
return 0 /* False */;
|
|
34514
34514
|
}
|
|
34515
|
-
function isParenthesizedArrowFunctionExpressionWorker() {
|
|
34515
|
+
function isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction) {
|
|
34516
34516
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34517
34517
|
nextToken();
|
|
34518
34518
|
if (scanner.hasPrecedingLineBreak()) {
|
|
@@ -34532,8 +34532,13 @@ var ts;
|
|
|
34532
34532
|
// but this is probably what the user intended.
|
|
34533
34533
|
var third = nextToken();
|
|
34534
34534
|
switch (third) {
|
|
34535
|
-
case 38 /* EqualsGreaterThanToken */:
|
|
34536
34535
|
case 58 /* ColonToken */:
|
|
34536
|
+
if (disallowReturnTypeInArrowFunction) {
|
|
34537
|
+
// "a ? () : ..."
|
|
34538
|
+
return 0 /* False */;
|
|
34539
|
+
}
|
|
34540
|
+
return 1 /* True */;
|
|
34541
|
+
case 38 /* EqualsGreaterThanToken */:
|
|
34537
34542
|
case 18 /* OpenBraceToken */:
|
|
34538
34543
|
return 1 /* True */;
|
|
34539
34544
|
default:
|
|
@@ -34700,7 +34705,18 @@ var ts;
|
|
|
34700
34705
|
return undefined;
|
|
34701
34706
|
}
|
|
34702
34707
|
}
|
|
34703
|
-
|
|
34708
|
+
// Given:
|
|
34709
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
34710
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
34711
|
+
// ({ y }) : z => ({ z })
|
|
34712
|
+
// This is a valid arrow function with "z" as the return type.
|
|
34713
|
+
//
|
|
34714
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
34715
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34716
|
+
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34717
|
+
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34718
|
+
return undefined;
|
|
34719
|
+
}
|
|
34704
34720
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34705
34721
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34706
34722
|
return undefined;
|
|
@@ -34731,30 +34747,6 @@ var ts;
|
|
|
34731
34747
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34732
34748
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
34733
34749
|
: 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
34750
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34759
34751
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34760
34752
|
}
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -34277,7 +34277,7 @@ var ts;
|
|
|
34277
34277
|
return addJSDocComment(finishNode(node, pos));
|
|
34278
34278
|
}
|
|
34279
34279
|
function tryParseParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34280
|
-
var triState = isParenthesizedArrowFunctionExpression();
|
|
34280
|
+
var triState = isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction);
|
|
34281
34281
|
if (triState === 0 /* False */) {
|
|
34282
34282
|
// It's definitely not a parenthesized arrow function expression.
|
|
34283
34283
|
return undefined;
|
|
@@ -34287,16 +34287,16 @@ 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.
|
|
34294
34294
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
34295
34295
|
// Unknown -> There *might* be a parenthesized arrow function here.
|
|
34296
34296
|
// Speculatively look ahead to be sure, and rollback if not.
|
|
34297
|
-
function isParenthesizedArrowFunctionExpression() {
|
|
34297
|
+
function isParenthesizedArrowFunctionExpression(disallowReturnTypeInArrowFunction) {
|
|
34298
34298
|
if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */ || token() === 131 /* AsyncKeyword */) {
|
|
34299
|
-
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
|
|
34299
|
+
return lookAhead(function () { return isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction); });
|
|
34300
34300
|
}
|
|
34301
34301
|
if (token() === 38 /* EqualsGreaterThanToken */) {
|
|
34302
34302
|
// ERROR RECOVERY TWEAK:
|
|
@@ -34307,7 +34307,7 @@ var ts;
|
|
|
34307
34307
|
// Definitely not a parenthesized arrow function.
|
|
34308
34308
|
return 0 /* False */;
|
|
34309
34309
|
}
|
|
34310
|
-
function isParenthesizedArrowFunctionExpressionWorker() {
|
|
34310
|
+
function isParenthesizedArrowFunctionExpressionWorker(disallowReturnTypeInArrowFunction) {
|
|
34311
34311
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34312
34312
|
nextToken();
|
|
34313
34313
|
if (scanner.hasPrecedingLineBreak()) {
|
|
@@ -34327,8 +34327,13 @@ var ts;
|
|
|
34327
34327
|
// but this is probably what the user intended.
|
|
34328
34328
|
var third = nextToken();
|
|
34329
34329
|
switch (third) {
|
|
34330
|
-
case 38 /* EqualsGreaterThanToken */:
|
|
34331
34330
|
case 58 /* ColonToken */:
|
|
34331
|
+
if (disallowReturnTypeInArrowFunction) {
|
|
34332
|
+
// "a ? () : ..."
|
|
34333
|
+
return 0 /* False */;
|
|
34334
|
+
}
|
|
34335
|
+
return 1 /* True */;
|
|
34336
|
+
case 38 /* EqualsGreaterThanToken */:
|
|
34332
34337
|
case 18 /* OpenBraceToken */:
|
|
34333
34338
|
return 1 /* True */;
|
|
34334
34339
|
default:
|
|
@@ -34495,7 +34500,18 @@ var ts;
|
|
|
34495
34500
|
return undefined;
|
|
34496
34501
|
}
|
|
34497
34502
|
}
|
|
34498
|
-
|
|
34503
|
+
// Given:
|
|
34504
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
34505
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
34506
|
+
// ({ y }) : z => ({ z })
|
|
34507
|
+
// This is a valid arrow function with "z" as the return type.
|
|
34508
|
+
//
|
|
34509
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
34510
|
+
// terminates the expression, so we cannot allow a return type, even if we aren't
|
|
34511
|
+
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34512
|
+
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34513
|
+
return undefined;
|
|
34514
|
+
}
|
|
34499
34515
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34500
34516
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34501
34517
|
return undefined;
|
|
@@ -34526,30 +34542,6 @@ var ts;
|
|
|
34526
34542
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34527
34543
|
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier), disallowReturnTypeInArrowFunction)
|
|
34528
34544
|
: 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
34545
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34554
34546
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34555
34547
|
}
|
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-48791-4",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|