@typescript-deploys/pr-build 4.6.0-pr-47548-5 → 4.6.0-pr-47550-8
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/lib.es5.d.ts +0 -5
- package/lib/tsc.js +30 -34
- package/lib/tsserver.js +40 -34
- package/lib/tsserverlibrary.js +40 -34
- package/lib/typescript.js +40 -34
- package/lib/typescriptServices.js +40 -34
- package/lib/typingsInstaller.js +40 -34
- package/package.json +1 -1
package/lib/lib.es5.d.ts
CHANGED
|
@@ -1625,11 +1625,6 @@ type Uncapitalize<S extends string> = intrinsic;
|
|
|
1625
1625
|
*/
|
|
1626
1626
|
interface ThisType<T> { }
|
|
1627
1627
|
|
|
1628
|
-
/**
|
|
1629
|
-
* Marker for yield expressions return types
|
|
1630
|
-
*/
|
|
1631
|
-
interface YieldType<T> { }
|
|
1632
|
-
|
|
1633
1628
|
/**
|
|
1634
1629
|
* Represents a raw buffer of binary data, which is used to store data for the
|
|
1635
1630
|
* different typed arrays. ArrayBuffers cannot be read from or written to directly,
|
package/lib/tsc.js
CHANGED
|
@@ -72,12 +72,18 @@ var ts;
|
|
|
72
72
|
ts.version = ts.versionMajorMinor + ".0-insiders.20220124";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
|
+
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
76
|
+
typeof global !== "undefined" ? global :
|
|
77
|
+
typeof self !== "undefined" ? self :
|
|
78
|
+
undefined;
|
|
75
79
|
function tryGetNativeMap() {
|
|
76
|
-
|
|
80
|
+
var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
|
|
81
|
+
return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
|
|
77
82
|
}
|
|
78
83
|
NativeCollections.tryGetNativeMap = tryGetNativeMap;
|
|
79
84
|
function tryGetNativeSet() {
|
|
80
|
-
|
|
85
|
+
var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
|
|
86
|
+
return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
|
|
81
87
|
}
|
|
82
88
|
NativeCollections.tryGetNativeSet = tryGetNativeSet;
|
|
83
89
|
})(NativeCollections || (NativeCollections = {}));
|
|
@@ -26926,18 +26932,18 @@ var ts;
|
|
|
26926
26932
|
function parseInitializer() {
|
|
26927
26933
|
return parseOptional(63) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
26928
26934
|
}
|
|
26929
|
-
function parseAssignmentExpressionOrHigher() {
|
|
26935
|
+
function parseAssignmentExpressionOrHigher(parsingConditionalExpression) {
|
|
26930
26936
|
if (isYieldExpression()) {
|
|
26931
26937
|
return parseYieldExpression();
|
|
26932
26938
|
}
|
|
26933
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
26939
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(parsingConditionalExpression) || tryParseAsyncSimpleArrowFunctionExpression();
|
|
26934
26940
|
if (arrowExpression) {
|
|
26935
26941
|
return arrowExpression;
|
|
26936
26942
|
}
|
|
26937
26943
|
var pos = getNodePos();
|
|
26938
26944
|
var expr = parseBinaryExpressionOrHigher(0);
|
|
26939
26945
|
if (expr.kind === 79 && token() === 38) {
|
|
26940
|
-
return parseSimpleArrowFunctionExpression(pos, expr, undefined);
|
|
26946
|
+
return parseSimpleArrowFunctionExpression(pos, expr, undefined, parsingConditionalExpression);
|
|
26941
26947
|
}
|
|
26942
26948
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
26943
26949
|
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
@@ -26968,24 +26974,24 @@ var ts;
|
|
|
26968
26974
|
return finishNode(factory.createYieldExpression(undefined, undefined), pos);
|
|
26969
26975
|
}
|
|
26970
26976
|
}
|
|
26971
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
26977
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier, parsingConditionalExpression) {
|
|
26972
26978
|
ts.Debug.assert(token() === 38, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
26973
26979
|
var parameter = factory.createParameterDeclaration(undefined, undefined, undefined, identifier, undefined, undefined, undefined);
|
|
26974
26980
|
finishNode(parameter, identifier.pos);
|
|
26975
26981
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
26976
26982
|
var equalsGreaterThanToken = parseExpectedToken(38);
|
|
26977
|
-
var body = parseArrowFunctionExpressionBody(!!asyncModifier);
|
|
26983
|
+
var body = parseArrowFunctionExpressionBody(!!asyncModifier, parsingConditionalExpression);
|
|
26978
26984
|
var node = factory.createArrowFunction(asyncModifier, undefined, parameters, undefined, equalsGreaterThanToken, body);
|
|
26979
26985
|
return addJSDocComment(finishNode(node, pos));
|
|
26980
26986
|
}
|
|
26981
|
-
function tryParseParenthesizedArrowFunctionExpression() {
|
|
26987
|
+
function tryParseParenthesizedArrowFunctionExpression(parsingConditionalExpression) {
|
|
26982
26988
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
26983
26989
|
if (triState === 0) {
|
|
26984
26990
|
return undefined;
|
|
26985
26991
|
}
|
|
26986
26992
|
return triState === 1 ?
|
|
26987
|
-
parseParenthesizedArrowFunctionExpression(true) :
|
|
26988
|
-
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
26993
|
+
parseParenthesizedArrowFunctionExpression(true, parsingConditionalExpression) :
|
|
26994
|
+
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalExpression); });
|
|
26989
26995
|
}
|
|
26990
26996
|
function isParenthesizedArrowFunctionExpression() {
|
|
26991
26997
|
if (token() === 20 || token() === 29 || token() === 131) {
|
|
@@ -27079,24 +27085,24 @@ var ts;
|
|
|
27079
27085
|
return 2;
|
|
27080
27086
|
}
|
|
27081
27087
|
}
|
|
27082
|
-
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
27088
|
+
function parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalExpression) {
|
|
27083
27089
|
var tokenPos = scanner.getTokenPos();
|
|
27084
27090
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
27085
27091
|
return undefined;
|
|
27086
27092
|
}
|
|
27087
|
-
var result = parseParenthesizedArrowFunctionExpression(false);
|
|
27093
|
+
var result = parseParenthesizedArrowFunctionExpression(false, parsingConditionalExpression);
|
|
27088
27094
|
if (!result) {
|
|
27089
27095
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
27090
27096
|
}
|
|
27091
27097
|
return result;
|
|
27092
27098
|
}
|
|
27093
|
-
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
27099
|
+
function tryParseAsyncSimpleArrowFunctionExpression(parsingConditionalExpression) {
|
|
27094
27100
|
if (token() === 131) {
|
|
27095
27101
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1) {
|
|
27096
27102
|
var pos = getNodePos();
|
|
27097
27103
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
27098
27104
|
var expr = parseBinaryExpressionOrHigher(0);
|
|
27099
|
-
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
27105
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier, parsingConditionalExpression);
|
|
27100
27106
|
}
|
|
27101
27107
|
}
|
|
27102
27108
|
return undefined;
|
|
@@ -27114,7 +27120,7 @@ var ts;
|
|
|
27114
27120
|
}
|
|
27115
27121
|
return 0;
|
|
27116
27122
|
}
|
|
27117
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
27123
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, parsingConditionalExpression) {
|
|
27118
27124
|
var pos = getNodePos();
|
|
27119
27125
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
27120
27126
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -27133,6 +27139,10 @@ var ts;
|
|
|
27133
27139
|
return undefined;
|
|
27134
27140
|
}
|
|
27135
27141
|
}
|
|
27142
|
+
if (parsingConditionalExpression && token() === 58) {
|
|
27143
|
+
ts.Debug.assert(!allowAmbiguity);
|
|
27144
|
+
return undefined;
|
|
27145
|
+
}
|
|
27136
27146
|
var type = parseReturnType(58, false);
|
|
27137
27147
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
27138
27148
|
return undefined;
|
|
@@ -27153,7 +27163,7 @@ var ts;
|
|
|
27153
27163
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
27154
27164
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
27155
27165
|
}
|
|
27156
|
-
function parseArrowFunctionExpressionBody(isAsync) {
|
|
27166
|
+
function parseArrowFunctionExpressionBody(isAsync, parsingConditionalExpression) {
|
|
27157
27167
|
if (token() === 18) {
|
|
27158
27168
|
return parseFunctionBlock(isAsync ? 2 : 0);
|
|
27159
27169
|
}
|
|
@@ -27167,8 +27177,8 @@ var ts;
|
|
|
27167
27177
|
var savedTopLevel = topLevel;
|
|
27168
27178
|
topLevel = false;
|
|
27169
27179
|
var node = isAsync
|
|
27170
|
-
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
27171
|
-
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
27180
|
+
? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalExpression); })
|
|
27181
|
+
: doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalExpression); });
|
|
27172
27182
|
topLevel = savedTopLevel;
|
|
27173
27183
|
return node;
|
|
27174
27184
|
}
|
|
@@ -27178,8 +27188,8 @@ var ts;
|
|
|
27178
27188
|
return leftOperand;
|
|
27179
27189
|
}
|
|
27180
27190
|
var colonToken;
|
|
27181
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58), ts.nodeIsPresent(colonToken)
|
|
27182
|
-
? parseAssignmentExpressionOrHigher()
|
|
27191
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(true); }), colonToken = parseExpectedToken(58), ts.nodeIsPresent(colonToken)
|
|
27192
|
+
? parseAssignmentExpressionOrHigher(true)
|
|
27183
27193
|
: createMissingNode(79, false, ts.Diagnostics._0_expected, ts.tokenToString(58))), pos);
|
|
27184
27194
|
}
|
|
27185
27195
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -38903,7 +38913,6 @@ var ts;
|
|
|
38903
38913
|
var globalBooleanType;
|
|
38904
38914
|
var globalRegExpType;
|
|
38905
38915
|
var globalThisType;
|
|
38906
|
-
var globalYieldType;
|
|
38907
38916
|
var anyArrayType;
|
|
38908
38917
|
var autoArrayType;
|
|
38909
38918
|
var anyReadonlyArrayType;
|
|
@@ -58927,14 +58936,6 @@ var ts;
|
|
|
58927
58936
|
return t.flags & 2097152 ? ts.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t);
|
|
58928
58937
|
});
|
|
58929
58938
|
}
|
|
58930
|
-
function getYieldTypeArgument(type) {
|
|
58931
|
-
return ts.getObjectFlags(type) & 4 && type.target === globalYieldType ? getTypeArguments(type)[0] : undefined;
|
|
58932
|
-
}
|
|
58933
|
-
function getYieldTypeFromContextualType(type) {
|
|
58934
|
-
return mapType(type, function (t) {
|
|
58935
|
-
return t.flags & 2097152 ? ts.forEach(t.types, getYieldTypeArgument) : getYieldTypeArgument(t);
|
|
58936
|
-
});
|
|
58937
|
-
}
|
|
58938
58939
|
function getContextualThisParameterType(func) {
|
|
58939
58940
|
if (func.kind === 213) {
|
|
58940
58941
|
return undefined;
|
|
@@ -64945,10 +64946,6 @@ var ts;
|
|
|
64945
64946
|
return getIterationTypeOfIterable(use, 1, yieldExpressionType, node.expression)
|
|
64946
64947
|
|| anyType;
|
|
64947
64948
|
}
|
|
64948
|
-
var suggestedReturnType = yieldedType && getYieldTypeFromContextualType(yieldedType);
|
|
64949
|
-
if (suggestedReturnType) {
|
|
64950
|
-
return suggestedReturnType;
|
|
64951
|
-
}
|
|
64952
64949
|
else if (returnType) {
|
|
64953
64950
|
return getIterationTypeOfGeneratorFunctionReturnType(2, returnType, isAsync)
|
|
64954
64951
|
|| anyType;
|
|
@@ -71740,7 +71737,6 @@ var ts;
|
|
|
71740
71737
|
globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", 1) || globalArrayType;
|
|
71741
71738
|
anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;
|
|
71742
71739
|
globalThisType = getGlobalTypeOrUndefined("ThisType", 1);
|
|
71743
|
-
globalYieldType = getGlobalTypeOrUndefined("YieldType", 1);
|
|
71744
71740
|
if (augmentations) {
|
|
71745
71741
|
for (var _h = 0, augmentations_2 = augmentations; _h < augmentations_2.length; _h++) {
|
|
71746
71742
|
var list = augmentations_2[_h];
|
package/lib/tsserver.js
CHANGED
|
@@ -111,13 +111,18 @@ var ts;
|
|
|
111
111
|
/* @internal */
|
|
112
112
|
var NativeCollections;
|
|
113
113
|
(function (NativeCollections) {
|
|
114
|
+
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
115
|
+
typeof global !== "undefined" ? global :
|
|
116
|
+
typeof self !== "undefined" ? self :
|
|
117
|
+
undefined;
|
|
114
118
|
/**
|
|
115
119
|
* Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
|
|
116
120
|
*/
|
|
117
121
|
function tryGetNativeMap() {
|
|
118
122
|
// Internet Explorer's Map doesn't support iteration, so don't use it.
|
|
123
|
+
var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
|
|
119
124
|
// eslint-disable-next-line no-in-operator
|
|
120
|
-
return typeof
|
|
125
|
+
return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
|
|
121
126
|
}
|
|
122
127
|
NativeCollections.tryGetNativeMap = tryGetNativeMap;
|
|
123
128
|
/**
|
|
@@ -125,8 +130,9 @@ var ts;
|
|
|
125
130
|
*/
|
|
126
131
|
function tryGetNativeSet() {
|
|
127
132
|
// Internet Explorer's Set doesn't support iteration, so don't use it.
|
|
133
|
+
var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
|
|
128
134
|
// eslint-disable-next-line no-in-operator
|
|
129
|
-
return typeof
|
|
135
|
+
return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
|
|
130
136
|
}
|
|
131
137
|
NativeCollections.tryGetNativeSet = tryGetNativeSet;
|
|
132
138
|
})(NativeCollections || (NativeCollections = {}));
|
|
@@ -33366,7 +33372,7 @@ var ts;
|
|
|
33366
33372
|
function parseInitializer() {
|
|
33367
33373
|
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
33368
33374
|
}
|
|
33369
|
-
function parseAssignmentExpressionOrHigher() {
|
|
33375
|
+
function parseAssignmentExpressionOrHigher(parsingConditionalExpression) {
|
|
33370
33376
|
// AssignmentExpression[in,yield]:
|
|
33371
33377
|
// 1) ConditionalExpression[?in,?yield]
|
|
33372
33378
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -33392,7 +33398,7 @@ var ts;
|
|
|
33392
33398
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
33393
33399
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
33394
33400
|
// with AssignmentExpression if we see one.
|
|
33395
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
33401
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(parsingConditionalExpression) || tryParseAsyncSimpleArrowFunctionExpression();
|
|
33396
33402
|
if (arrowExpression) {
|
|
33397
33403
|
return arrowExpression;
|
|
33398
33404
|
}
|
|
@@ -33411,7 +33417,7 @@ var ts;
|
|
|
33411
33417
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
33412
33418
|
// identifier and the current token is an arrow.
|
|
33413
33419
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
33414
|
-
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
33420
|
+
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined, parsingConditionalExpression);
|
|
33415
33421
|
}
|
|
33416
33422
|
// Now see if we might be in cases '2' or '3'.
|
|
33417
33423
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -33471,7 +33477,7 @@ var ts;
|
|
|
33471
33477
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
33472
33478
|
}
|
|
33473
33479
|
}
|
|
33474
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
33480
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier, parsingConditionalExpression) {
|
|
33475
33481
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
33476
33482
|
var parameter = factory.createParameterDeclaration(
|
|
33477
33483
|
/*decorators*/ undefined,
|
|
@@ -33483,11 +33489,11 @@ var ts;
|
|
|
33483
33489
|
finishNode(parameter, identifier.pos);
|
|
33484
33490
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
33485
33491
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
33486
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
33492
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, parsingConditionalExpression);
|
|
33487
33493
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
33488
33494
|
return addJSDocComment(finishNode(node, pos));
|
|
33489
33495
|
}
|
|
33490
|
-
function tryParseParenthesizedArrowFunctionExpression() {
|
|
33496
|
+
function tryParseParenthesizedArrowFunctionExpression(parsingConditionalExpression) {
|
|
33491
33497
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
33492
33498
|
if (triState === 0 /* False */) {
|
|
33493
33499
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -33498,8 +33504,8 @@ var ts;
|
|
|
33498
33504
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
33499
33505
|
// expression instead.
|
|
33500
33506
|
return triState === 1 /* True */ ?
|
|
33501
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
33502
|
-
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
33507
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, parsingConditionalExpression) :
|
|
33508
|
+
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalExpression); });
|
|
33503
33509
|
}
|
|
33504
33510
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
33505
33511
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -33629,25 +33635,25 @@ var ts;
|
|
|
33629
33635
|
return 2 /* Unknown */;
|
|
33630
33636
|
}
|
|
33631
33637
|
}
|
|
33632
|
-
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
33638
|
+
function parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalExpression) {
|
|
33633
33639
|
var tokenPos = scanner.getTokenPos();
|
|
33634
33640
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
33635
33641
|
return undefined;
|
|
33636
33642
|
}
|
|
33637
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
33643
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, parsingConditionalExpression);
|
|
33638
33644
|
if (!result) {
|
|
33639
33645
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
33640
33646
|
}
|
|
33641
33647
|
return result;
|
|
33642
33648
|
}
|
|
33643
|
-
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
33649
|
+
function tryParseAsyncSimpleArrowFunctionExpression(parsingConditionalExpression) {
|
|
33644
33650
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
33645
33651
|
if (token() === 131 /* AsyncKeyword */) {
|
|
33646
33652
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
33647
33653
|
var pos = getNodePos();
|
|
33648
33654
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
33649
33655
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
33650
|
-
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
33656
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier, parsingConditionalExpression);
|
|
33651
33657
|
}
|
|
33652
33658
|
}
|
|
33653
33659
|
return undefined;
|
|
@@ -33671,7 +33677,7 @@ var ts;
|
|
|
33671
33677
|
}
|
|
33672
33678
|
return 0 /* False */;
|
|
33673
33679
|
}
|
|
33674
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
33680
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, parsingConditionalExpression) {
|
|
33675
33681
|
var pos = getNodePos();
|
|
33676
33682
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
33677
33683
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -33697,6 +33703,20 @@ var ts;
|
|
|
33697
33703
|
return undefined;
|
|
33698
33704
|
}
|
|
33699
33705
|
}
|
|
33706
|
+
// Given:
|
|
33707
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
33708
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
33709
|
+
// ({ y }) : z => ({ z })
|
|
33710
|
+
// This is a valid arrow function with "z" as the return type.
|
|
33711
|
+
//
|
|
33712
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
33713
|
+
// terminates the true side, so cannot be the return type. If we are in the
|
|
33714
|
+
// false side, we may still be within the true side of a parent conditional
|
|
33715
|
+
// expression, so don't allow it to be a return type either.
|
|
33716
|
+
if (parsingConditionalExpression && token() === 58 /* ColonToken */) {
|
|
33717
|
+
ts.Debug.assert(!allowAmbiguity);
|
|
33718
|
+
return undefined;
|
|
33719
|
+
}
|
|
33700
33720
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
33701
33721
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
33702
33722
|
return undefined;
|
|
@@ -33730,7 +33750,7 @@ var ts;
|
|
|
33730
33750
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
33731
33751
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
33732
33752
|
}
|
|
33733
|
-
function parseArrowFunctionExpressionBody(isAsync) {
|
|
33753
|
+
function parseArrowFunctionExpressionBody(isAsync, parsingConditionalExpression) {
|
|
33734
33754
|
if (token() === 18 /* OpenBraceToken */) {
|
|
33735
33755
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
33736
33756
|
}
|
|
@@ -33758,8 +33778,8 @@ var ts;
|
|
|
33758
33778
|
var savedTopLevel = topLevel;
|
|
33759
33779
|
topLevel = false;
|
|
33760
33780
|
var node = isAsync
|
|
33761
|
-
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
33762
|
-
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
33781
|
+
? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalExpression); })
|
|
33782
|
+
: doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalExpression); });
|
|
33763
33783
|
topLevel = savedTopLevel;
|
|
33764
33784
|
return node;
|
|
33765
33785
|
}
|
|
@@ -33772,8 +33792,8 @@ var ts;
|
|
|
33772
33792
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
33773
33793
|
// we do not that for the 'whenFalse' part.
|
|
33774
33794
|
var colonToken;
|
|
33775
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
33776
|
-
? parseAssignmentExpressionOrHigher()
|
|
33795
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*parsingConditionalExpression*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
33796
|
+
? parseAssignmentExpressionOrHigher(/*parsingConditionalExpression*/ true)
|
|
33777
33797
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
33778
33798
|
}
|
|
33779
33799
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -47507,7 +47527,6 @@ var ts;
|
|
|
47507
47527
|
var globalBooleanType;
|
|
47508
47528
|
var globalRegExpType;
|
|
47509
47529
|
var globalThisType;
|
|
47510
|
-
var globalYieldType;
|
|
47511
47530
|
var anyArrayType;
|
|
47512
47531
|
var autoArrayType;
|
|
47513
47532
|
var anyReadonlyArrayType;
|
|
@@ -70600,14 +70619,6 @@ var ts;
|
|
|
70600
70619
|
return t.flags & 2097152 /* Intersection */ ? ts.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t);
|
|
70601
70620
|
});
|
|
70602
70621
|
}
|
|
70603
|
-
function getYieldTypeArgument(type) {
|
|
70604
|
-
return ts.getObjectFlags(type) & 4 /* Reference */ && type.target === globalYieldType ? getTypeArguments(type)[0] : undefined;
|
|
70605
|
-
}
|
|
70606
|
-
function getYieldTypeFromContextualType(type) {
|
|
70607
|
-
return mapType(type, function (t) {
|
|
70608
|
-
return t.flags & 2097152 /* Intersection */ ? ts.forEach(t.types, getYieldTypeArgument) : getYieldTypeArgument(t);
|
|
70609
|
-
});
|
|
70610
|
-
}
|
|
70611
70622
|
function getContextualThisParameterType(func) {
|
|
70612
70623
|
if (func.kind === 213 /* ArrowFunction */) {
|
|
70613
70624
|
return undefined;
|
|
@@ -77551,10 +77562,6 @@ var ts;
|
|
|
77551
77562
|
return getIterationTypeOfIterable(use, 1 /* Return */, yieldExpressionType, node.expression)
|
|
77552
77563
|
|| anyType;
|
|
77553
77564
|
}
|
|
77554
|
-
var suggestedReturnType = yieldedType && getYieldTypeFromContextualType(yieldedType);
|
|
77555
|
-
if (suggestedReturnType) {
|
|
77556
|
-
return suggestedReturnType;
|
|
77557
|
-
}
|
|
77558
77565
|
else if (returnType) {
|
|
77559
77566
|
return getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, isAsync)
|
|
77560
77567
|
|| anyType;
|
|
@@ -85493,7 +85500,6 @@ var ts;
|
|
|
85493
85500
|
globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", /*arity*/ 1) || globalArrayType;
|
|
85494
85501
|
anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;
|
|
85495
85502
|
globalThisType = getGlobalTypeOrUndefined("ThisType", /*arity*/ 1);
|
|
85496
|
-
globalYieldType = getGlobalTypeOrUndefined("YieldType", /*arity*/ 1);
|
|
85497
85503
|
if (augmentations) {
|
|
85498
85504
|
// merge _nonglobal_ module augmentations.
|
|
85499
85505
|
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -305,13 +305,18 @@ var ts;
|
|
|
305
305
|
/* @internal */
|
|
306
306
|
var NativeCollections;
|
|
307
307
|
(function (NativeCollections) {
|
|
308
|
+
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
309
|
+
typeof global !== "undefined" ? global :
|
|
310
|
+
typeof self !== "undefined" ? self :
|
|
311
|
+
undefined;
|
|
308
312
|
/**
|
|
309
313
|
* Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
|
|
310
314
|
*/
|
|
311
315
|
function tryGetNativeMap() {
|
|
312
316
|
// Internet Explorer's Map doesn't support iteration, so don't use it.
|
|
317
|
+
var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
|
|
313
318
|
// eslint-disable-next-line no-in-operator
|
|
314
|
-
return typeof
|
|
319
|
+
return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
|
|
315
320
|
}
|
|
316
321
|
NativeCollections.tryGetNativeMap = tryGetNativeMap;
|
|
317
322
|
/**
|
|
@@ -319,8 +324,9 @@ var ts;
|
|
|
319
324
|
*/
|
|
320
325
|
function tryGetNativeSet() {
|
|
321
326
|
// Internet Explorer's Set doesn't support iteration, so don't use it.
|
|
327
|
+
var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
|
|
322
328
|
// eslint-disable-next-line no-in-operator
|
|
323
|
-
return typeof
|
|
329
|
+
return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
|
|
324
330
|
}
|
|
325
331
|
NativeCollections.tryGetNativeSet = tryGetNativeSet;
|
|
326
332
|
})(NativeCollections || (NativeCollections = {}));
|
|
@@ -33560,7 +33566,7 @@ var ts;
|
|
|
33560
33566
|
function parseInitializer() {
|
|
33561
33567
|
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
33562
33568
|
}
|
|
33563
|
-
function parseAssignmentExpressionOrHigher() {
|
|
33569
|
+
function parseAssignmentExpressionOrHigher(parsingConditionalExpression) {
|
|
33564
33570
|
// AssignmentExpression[in,yield]:
|
|
33565
33571
|
// 1) ConditionalExpression[?in,?yield]
|
|
33566
33572
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -33586,7 +33592,7 @@ var ts;
|
|
|
33586
33592
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
33587
33593
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
33588
33594
|
// with AssignmentExpression if we see one.
|
|
33589
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
33595
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(parsingConditionalExpression) || tryParseAsyncSimpleArrowFunctionExpression();
|
|
33590
33596
|
if (arrowExpression) {
|
|
33591
33597
|
return arrowExpression;
|
|
33592
33598
|
}
|
|
@@ -33605,7 +33611,7 @@ var ts;
|
|
|
33605
33611
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
33606
33612
|
// identifier and the current token is an arrow.
|
|
33607
33613
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
33608
|
-
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
33614
|
+
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined, parsingConditionalExpression);
|
|
33609
33615
|
}
|
|
33610
33616
|
// Now see if we might be in cases '2' or '3'.
|
|
33611
33617
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -33665,7 +33671,7 @@ var ts;
|
|
|
33665
33671
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
33666
33672
|
}
|
|
33667
33673
|
}
|
|
33668
|
-
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
33674
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier, parsingConditionalExpression) {
|
|
33669
33675
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
33670
33676
|
var parameter = factory.createParameterDeclaration(
|
|
33671
33677
|
/*decorators*/ undefined,
|
|
@@ -33677,11 +33683,11 @@ var ts;
|
|
|
33677
33683
|
finishNode(parameter, identifier.pos);
|
|
33678
33684
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
33679
33685
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
33680
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
33686
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier, parsingConditionalExpression);
|
|
33681
33687
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
33682
33688
|
return addJSDocComment(finishNode(node, pos));
|
|
33683
33689
|
}
|
|
33684
|
-
function tryParseParenthesizedArrowFunctionExpression() {
|
|
33690
|
+
function tryParseParenthesizedArrowFunctionExpression(parsingConditionalExpression) {
|
|
33685
33691
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
33686
33692
|
if (triState === 0 /* False */) {
|
|
33687
33693
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -33692,8 +33698,8 @@ var ts;
|
|
|
33692
33698
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
33693
33699
|
// expression instead.
|
|
33694
33700
|
return triState === 1 /* True */ ?
|
|
33695
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
33696
|
-
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
33701
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true, parsingConditionalExpression) :
|
|
33702
|
+
tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalExpression); });
|
|
33697
33703
|
}
|
|
33698
33704
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
33699
33705
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -33823,25 +33829,25 @@ var ts;
|
|
|
33823
33829
|
return 2 /* Unknown */;
|
|
33824
33830
|
}
|
|
33825
33831
|
}
|
|
33826
|
-
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
33832
|
+
function parsePossibleParenthesizedArrowFunctionExpression(parsingConditionalExpression) {
|
|
33827
33833
|
var tokenPos = scanner.getTokenPos();
|
|
33828
33834
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
33829
33835
|
return undefined;
|
|
33830
33836
|
}
|
|
33831
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
33837
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false, parsingConditionalExpression);
|
|
33832
33838
|
if (!result) {
|
|
33833
33839
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
33834
33840
|
}
|
|
33835
33841
|
return result;
|
|
33836
33842
|
}
|
|
33837
|
-
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
33843
|
+
function tryParseAsyncSimpleArrowFunctionExpression(parsingConditionalExpression) {
|
|
33838
33844
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
33839
33845
|
if (token() === 131 /* AsyncKeyword */) {
|
|
33840
33846
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
33841
33847
|
var pos = getNodePos();
|
|
33842
33848
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
33843
33849
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
33844
|
-
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
33850
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier, parsingConditionalExpression);
|
|
33845
33851
|
}
|
|
33846
33852
|
}
|
|
33847
33853
|
return undefined;
|
|
@@ -33865,7 +33871,7 @@ var ts;
|
|
|
33865
33871
|
}
|
|
33866
33872
|
return 0 /* False */;
|
|
33867
33873
|
}
|
|
33868
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
33874
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity, parsingConditionalExpression) {
|
|
33869
33875
|
var pos = getNodePos();
|
|
33870
33876
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
33871
33877
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -33891,6 +33897,20 @@ var ts;
|
|
|
33891
33897
|
return undefined;
|
|
33892
33898
|
}
|
|
33893
33899
|
}
|
|
33900
|
+
// Given:
|
|
33901
|
+
// x ? y => ({ y }) : z => ({ z })
|
|
33902
|
+
// We try to parse the body of the first arrow function by looking at:
|
|
33903
|
+
// ({ y }) : z => ({ z })
|
|
33904
|
+
// This is a valid arrow function with "z" as the return type.
|
|
33905
|
+
//
|
|
33906
|
+
// But, if we're in the true side of a conditional expression, this colon
|
|
33907
|
+
// terminates the true side, so cannot be the return type. If we are in the
|
|
33908
|
+
// false side, we may still be within the true side of a parent conditional
|
|
33909
|
+
// expression, so don't allow it to be a return type either.
|
|
33910
|
+
if (parsingConditionalExpression && token() === 58 /* ColonToken */) {
|
|
33911
|
+
ts.Debug.assert(!allowAmbiguity);
|
|
33912
|
+
return undefined;
|
|
33913
|
+
}
|
|
33894
33914
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
33895
33915
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
33896
33916
|
return undefined;
|
|
@@ -33924,7 +33944,7 @@ var ts;
|
|
|
33924
33944
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
33925
33945
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
33926
33946
|
}
|
|
33927
|
-
function parseArrowFunctionExpressionBody(isAsync) {
|
|
33947
|
+
function parseArrowFunctionExpressionBody(isAsync, parsingConditionalExpression) {
|
|
33928
33948
|
if (token() === 18 /* OpenBraceToken */) {
|
|
33929
33949
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
33930
33950
|
}
|
|
@@ -33952,8 +33972,8 @@ var ts;
|
|
|
33952
33972
|
var savedTopLevel = topLevel;
|
|
33953
33973
|
topLevel = false;
|
|
33954
33974
|
var node = isAsync
|
|
33955
|
-
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
33956
|
-
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
33975
|
+
? doInAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalExpression); })
|
|
33976
|
+
: doOutsideOfAwaitContext(function () { return parseAssignmentExpressionOrHigher(parsingConditionalExpression); });
|
|
33957
33977
|
topLevel = savedTopLevel;
|
|
33958
33978
|
return node;
|
|
33959
33979
|
}
|
|
@@ -33966,8 +33986,8 @@ var ts;
|
|
|
33966
33986
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
33967
33987
|
// we do not that for the 'whenFalse' part.
|
|
33968
33988
|
var colonToken;
|
|
33969
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
33970
|
-
? parseAssignmentExpressionOrHigher()
|
|
33989
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, function () { return parseAssignmentExpressionOrHigher(/*parsingConditionalExpression*/ true); }), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
33990
|
+
? parseAssignmentExpressionOrHigher(/*parsingConditionalExpression*/ true)
|
|
33971
33991
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
33972
33992
|
}
|
|
33973
33993
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -47701,7 +47721,6 @@ var ts;
|
|
|
47701
47721
|
var globalBooleanType;
|
|
47702
47722
|
var globalRegExpType;
|
|
47703
47723
|
var globalThisType;
|
|
47704
|
-
var globalYieldType;
|
|
47705
47724
|
var anyArrayType;
|
|
47706
47725
|
var autoArrayType;
|
|
47707
47726
|
var anyReadonlyArrayType;
|
|
@@ -70794,14 +70813,6 @@ var ts;
|
|
|
70794
70813
|
return t.flags & 2097152 /* Intersection */ ? ts.forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t);
|
|
70795
70814
|
});
|
|
70796
70815
|
}
|
|
70797
|
-
function getYieldTypeArgument(type) {
|
|
70798
|
-
return ts.getObjectFlags(type) & 4 /* Reference */ && type.target === globalYieldType ? getTypeArguments(type)[0] : undefined;
|
|
70799
|
-
}
|
|
70800
|
-
function getYieldTypeFromContextualType(type) {
|
|
70801
|
-
return mapType(type, function (t) {
|
|
70802
|
-
return t.flags & 2097152 /* Intersection */ ? ts.forEach(t.types, getYieldTypeArgument) : getYieldTypeArgument(t);
|
|
70803
|
-
});
|
|
70804
|
-
}
|
|
70805
70816
|
function getContextualThisParameterType(func) {
|
|
70806
70817
|
if (func.kind === 213 /* ArrowFunction */) {
|
|
70807
70818
|
return undefined;
|
|
@@ -77745,10 +77756,6 @@ var ts;
|
|
|
77745
77756
|
return getIterationTypeOfIterable(use, 1 /* Return */, yieldExpressionType, node.expression)
|
|
77746
77757
|
|| anyType;
|
|
77747
77758
|
}
|
|
77748
|
-
var suggestedReturnType = yieldedType && getYieldTypeFromContextualType(yieldedType);
|
|
77749
|
-
if (suggestedReturnType) {
|
|
77750
|
-
return suggestedReturnType;
|
|
77751
|
-
}
|
|
77752
77759
|
else if (returnType) {
|
|
77753
77760
|
return getIterationTypeOfGeneratorFunctionReturnType(2 /* Next */, returnType, isAsync)
|
|
77754
77761
|
|| anyType;
|
|
@@ -85687,7 +85694,6 @@ var ts;
|
|
|
85687
85694
|
globalReadonlyArrayType = getGlobalTypeOrUndefined("ReadonlyArray", /*arity*/ 1) || globalArrayType;
|
|
85688
85695
|
anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;
|
|
85689
85696
|
globalThisType = getGlobalTypeOrUndefined("ThisType", /*arity*/ 1);
|
|
85690
|
-
globalYieldType = getGlobalTypeOrUndefined("YieldType", /*arity*/ 1);
|
|
85691
85697
|
if (augmentations) {
|
|
85692
85698
|
// merge _nonglobal_ module augmentations.
|
|
85693
85699
|
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
|