typescript 4.6.0-dev.20211124 → 4.6.0-dev.20211201
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +57 -16
- package/lib/tsserver.js +160 -92
- package/lib/tsserverlibrary.js +160 -92
- package/lib/typescript.js +160 -92
- package/lib/typescriptServices.js +160 -92
- package/lib/typingsInstaller.js +68 -19
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211201";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -33597,9 +33597,10 @@ var ts;
|
|
|
33597
33597
|
// - "(x,y)" is a comma expression parsed as a signature with two parameters.
|
|
33598
33598
|
// - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation.
|
|
33599
33599
|
// - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type.
|
|
33600
|
+
// - "a ? (b): (function() {})" as well, but inside of a parenthesized type.
|
|
33600
33601
|
//
|
|
33601
33602
|
// So we need just a bit of lookahead to ensure that it can only be a signature.
|
|
33602
|
-
var hasJSDocFunctionType = type && ts.isJSDocFunctionType(type);
|
|
33603
|
+
var hasJSDocFunctionType = type && (ts.isJSDocFunctionType(type) || ts.isParenthesizedTypeNode(type) && ts.isJSDocFunctionType(type.type));
|
|
33603
33604
|
if (!allowAmbiguity && token() !== 38 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 18 /* OpenBraceToken */)) {
|
|
33604
33605
|
// Returning undefined here will cause our caller to rewind to where we started from.
|
|
33605
33606
|
return undefined;
|
|
@@ -90899,11 +90900,10 @@ var ts;
|
|
|
90899
90900
|
// we can safely elide the parentheses here, as a new synthetic
|
|
90900
90901
|
// ParenthesizedExpression will be inserted if we remove parentheses too
|
|
90901
90902
|
// aggressively.
|
|
90902
|
-
//
|
|
90903
|
-
//
|
|
90904
|
-
|
|
90905
|
-
|
|
90906
|
-
}
|
|
90903
|
+
//
|
|
90904
|
+
// If there are leading comments on the expression itself, the emitter will handle ASI
|
|
90905
|
+
// for return, throw, and yield by re-introducing parenthesis during emit on an as-need
|
|
90906
|
+
// basis.
|
|
90907
90907
|
return factory.createPartiallyEmittedExpression(expression, node);
|
|
90908
90908
|
}
|
|
90909
90909
|
return ts.visitEachChild(node, visitor, context);
|
|
@@ -94851,11 +94851,11 @@ var ts;
|
|
|
94851
94851
|
}
|
|
94852
94852
|
function visitOptionalExpression(node, captureThisArg, isDelete) {
|
|
94853
94853
|
var _a = flattenChain(node), expression = _a.expression, chain = _a.chain;
|
|
94854
|
-
var left = visitNonOptionalExpression(expression, ts.isCallChain(chain[0]), /*isDelete*/ false);
|
|
94854
|
+
var left = visitNonOptionalExpression(ts.skipPartiallyEmittedExpressions(expression), ts.isCallChain(chain[0]), /*isDelete*/ false);
|
|
94855
94855
|
var leftThisArg = ts.isSyntheticReference(left) ? left.thisArg : undefined;
|
|
94856
|
-
var
|
|
94857
|
-
var
|
|
94858
|
-
if (!ts.isSimpleCopiableExpression(
|
|
94856
|
+
var capturedLeft = ts.isSyntheticReference(left) ? left.expression : left;
|
|
94857
|
+
var leftExpression = factory.restoreOuterExpressions(expression, capturedLeft, 8 /* PartiallyEmittedExpressions */);
|
|
94858
|
+
if (!ts.isSimpleCopiableExpression(capturedLeft)) {
|
|
94859
94859
|
capturedLeft = factory.createTempVariable(hoistVariableDeclaration);
|
|
94860
94860
|
leftExpression = factory.createAssignment(capturedLeft, leftExpression);
|
|
94861
94861
|
}
|
|
@@ -94881,6 +94881,10 @@ var ts;
|
|
|
94881
94881
|
break;
|
|
94882
94882
|
case 207 /* CallExpression */:
|
|
94883
94883
|
if (i === 0 && leftThisArg) {
|
|
94884
|
+
if (!ts.isGeneratedIdentifier(leftThisArg)) {
|
|
94885
|
+
leftThisArg = factory.cloneNode(leftThisArg);
|
|
94886
|
+
ts.addEmitFlags(leftThisArg, 1536 /* NoComments */);
|
|
94887
|
+
}
|
|
94884
94888
|
rightExpression = factory.createFunctionCallCall(rightExpression, leftThisArg.kind === 106 /* SuperKeyword */ ? factory.createThis() : leftThisArg, ts.visitNodes(segment.arguments, visitor, ts.isExpression));
|
|
94885
94889
|
}
|
|
94886
94890
|
else {
|
|
@@ -109663,7 +109667,7 @@ var ts;
|
|
|
109663
109667
|
function emitYieldExpression(node) {
|
|
109664
109668
|
emitTokenWithComment(125 /* YieldKeyword */, node.pos, writeKeyword, node);
|
|
109665
109669
|
emit(node.asteriskToken);
|
|
109666
|
-
emitExpressionWithLeadingSpace(node.expression
|
|
109670
|
+
emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsiAndDisallowedComma);
|
|
109667
109671
|
}
|
|
109668
109672
|
function emitSpreadElement(node) {
|
|
109669
109673
|
emitTokenWithComment(25 /* DotDotDotToken */, node.pos, writePunctuation, node);
|
|
@@ -109860,9 +109864,49 @@ var ts;
|
|
|
109860
109864
|
}
|
|
109861
109865
|
return pos;
|
|
109862
109866
|
}
|
|
109867
|
+
function commentWillEmitNewLine(node) {
|
|
109868
|
+
return node.kind === 2 /* SingleLineCommentTrivia */ || !!node.hasTrailingNewLine;
|
|
109869
|
+
}
|
|
109870
|
+
function willEmitLeadingNewLine(node) {
|
|
109871
|
+
if (!currentSourceFile)
|
|
109872
|
+
return false;
|
|
109873
|
+
if (ts.some(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), commentWillEmitNewLine))
|
|
109874
|
+
return true;
|
|
109875
|
+
if (ts.some(ts.getSyntheticLeadingComments(node), commentWillEmitNewLine))
|
|
109876
|
+
return true;
|
|
109877
|
+
if (ts.isPartiallyEmittedExpression(node)) {
|
|
109878
|
+
if (node.pos !== node.expression.pos) {
|
|
109879
|
+
if (ts.some(ts.getTrailingCommentRanges(currentSourceFile.text, node.expression.pos), commentWillEmitNewLine))
|
|
109880
|
+
return true;
|
|
109881
|
+
}
|
|
109882
|
+
return willEmitLeadingNewLine(node.expression);
|
|
109883
|
+
}
|
|
109884
|
+
return false;
|
|
109885
|
+
}
|
|
109886
|
+
/**
|
|
109887
|
+
* Wraps an expression in parens if we would emit a leading comment that would introduce a line separator
|
|
109888
|
+
* between the node and its parent.
|
|
109889
|
+
*/
|
|
109890
|
+
function parenthesizeExpressionForNoAsi(node) {
|
|
109891
|
+
if (!commentsDisabled && ts.isPartiallyEmittedExpression(node) && willEmitLeadingNewLine(node)) {
|
|
109892
|
+
var parseNode = ts.getParseTreeNode(node);
|
|
109893
|
+
if (parseNode && ts.isParenthesizedExpression(parseNode)) {
|
|
109894
|
+
// If the original node was a parenthesized expression, restore it to preserve comment and source map emit
|
|
109895
|
+
var parens = ts.factory.createParenthesizedExpression(node.expression);
|
|
109896
|
+
ts.setOriginalNode(parens, node);
|
|
109897
|
+
ts.setTextRange(parens, parseNode);
|
|
109898
|
+
return parens;
|
|
109899
|
+
}
|
|
109900
|
+
return ts.factory.createParenthesizedExpression(node);
|
|
109901
|
+
}
|
|
109902
|
+
return node;
|
|
109903
|
+
}
|
|
109904
|
+
function parenthesizeExpressionForNoAsiAndDisallowedComma(node) {
|
|
109905
|
+
return parenthesizeExpressionForNoAsi(parenthesizer.parenthesizeExpressionForDisallowedComma(node));
|
|
109906
|
+
}
|
|
109863
109907
|
function emitReturnStatement(node) {
|
|
109864
109908
|
emitTokenWithComment(105 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
|
|
109865
|
-
emitExpressionWithLeadingSpace(node.expression);
|
|
109909
|
+
emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
|
|
109866
109910
|
writeTrailingSemicolon();
|
|
109867
109911
|
}
|
|
109868
109912
|
function emitWithStatement(node) {
|
|
@@ -109890,7 +109934,7 @@ var ts;
|
|
|
109890
109934
|
}
|
|
109891
109935
|
function emitThrowStatement(node) {
|
|
109892
109936
|
emitTokenWithComment(109 /* ThrowKeyword */, node.pos, writeKeyword, node);
|
|
109893
|
-
emitExpressionWithLeadingSpace(node.expression);
|
|
109937
|
+
emitExpressionWithLeadingSpace(parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
|
|
109894
109938
|
writeTrailingSemicolon();
|
|
109895
109939
|
}
|
|
109896
109940
|
function emitTryStatement(node) {
|
|
@@ -110734,7 +110778,14 @@ var ts;
|
|
|
110734
110778
|
}
|
|
110735
110779
|
// Transformation nodes
|
|
110736
110780
|
function emitPartiallyEmittedExpression(node) {
|
|
110781
|
+
var emitFlags = ts.getEmitFlags(node);
|
|
110782
|
+
if (!(emitFlags & 512 /* NoLeadingComments */) && node.pos !== node.expression.pos) {
|
|
110783
|
+
emitTrailingCommentsOfPosition(node.expression.pos);
|
|
110784
|
+
}
|
|
110737
110785
|
emitExpression(node.expression);
|
|
110786
|
+
if (!(emitFlags & 1024 /* NoTrailingComments */) && node.end !== node.expression.end) {
|
|
110787
|
+
emitLeadingCommentsOfPosition(node.expression.end);
|
|
110788
|
+
}
|
|
110738
110789
|
}
|
|
110739
110790
|
function emitCommaList(node) {
|
|
110740
110791
|
emitExpressionList(node, node.elements, 528 /* CommaListElements */, /*parenthesizerRule*/ undefined);
|
|
@@ -111098,10 +111149,8 @@ var ts;
|
|
|
111098
111149
|
// Emit this child.
|
|
111099
111150
|
previousSourceFileTextKind = recordBundleFileInternalSectionStart(child);
|
|
111100
111151
|
if (shouldEmitInterveningComments) {
|
|
111101
|
-
|
|
111102
|
-
|
|
111103
|
-
emitTrailingCommentsOfPosition(commentRange.pos);
|
|
111104
|
-
}
|
|
111152
|
+
var commentRange = ts.getCommentRange(child);
|
|
111153
|
+
emitTrailingCommentsOfPosition(commentRange.pos);
|
|
111105
111154
|
}
|
|
111106
111155
|
else {
|
|
111107
111156
|
shouldEmitInterveningComments = mayEmitInterveningComments;
|
|
@@ -111422,7 +111471,7 @@ var ts;
|
|
|
111422
111471
|
function writeLineSeparatorsAndIndentBefore(node, parent) {
|
|
111423
111472
|
var leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount(parent, [node], 0 /* None */);
|
|
111424
111473
|
if (leadingNewlines) {
|
|
111425
|
-
writeLinesAndIndent(leadingNewlines, /*
|
|
111474
|
+
writeLinesAndIndent(leadingNewlines, /*writeSpaceIfNotIndenting*/ false);
|
|
111426
111475
|
}
|
|
111427
111476
|
return !!leadingNewlines;
|
|
111428
111477
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.6.0-dev.
|
|
5
|
+
"version": "4.6.0-dev.20211201",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|