typescript 4.7.0-dev.20220422 → 4.7.0-dev.20220423
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 +50 -42
- package/lib/tsserver.js +89 -73
- package/lib/tsserverlibrary.js +89 -73
- package/lib/typescript.js +89 -73
- package/lib/typescriptServices.js +89 -73
- package/lib/typingsInstaller.js +52 -44
- 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.20220423";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -14691,7 +14691,7 @@ var ts;
|
|
|
14691
14691
|
var _a;
|
|
14692
14692
|
// If we don't need to downlevel and we can reach the original source text using
|
|
14693
14693
|
// the node's parent reference, then simply get the text as it was originally written.
|
|
14694
|
-
if (canUseOriginalText(node, flags)) {
|
|
14694
|
+
if (sourceFile && canUseOriginalText(node, flags)) {
|
|
14695
14695
|
return getSourceTextOfNodeFromSourceFile(sourceFile, node);
|
|
14696
14696
|
}
|
|
14697
14697
|
// If we can't reach the original source text, use the canonical form if it's a number,
|
|
@@ -75659,6 +75659,7 @@ var ts;
|
|
|
75659
75659
|
// decorators are applied to a declaration by the emitter, and not to an expression.
|
|
75660
75660
|
var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
|
|
75661
75661
|
var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts.some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
|
|
75662
|
+
argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
75662
75663
|
// The following variables are captured and modified by calls to chooseOverload.
|
|
75663
75664
|
// If overload resolution or type argument inference fails, we want to report the
|
|
75664
75665
|
// best error possible. The best error is one which says that an argument was not
|
|
@@ -75874,7 +75875,7 @@ var ts;
|
|
|
75874
75875
|
// If one or more context sensitive arguments were excluded, we start including
|
|
75875
75876
|
// them now (and keeping do so for any subsequent candidates) and perform a second
|
|
75876
75877
|
// round of type inference and applicability checking for this particular candidate.
|
|
75877
|
-
argCheckMode =
|
|
75878
|
+
argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
|
|
75878
75879
|
if (inferenceContext) {
|
|
75879
75880
|
var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
|
|
75880
75881
|
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
|
|
@@ -110503,7 +110504,7 @@ var ts;
|
|
|
110503
110504
|
setWriter(/*output*/ undefined, /*_sourceMapGenerator*/ undefined);
|
|
110504
110505
|
}
|
|
110505
110506
|
function getCurrentLineMap() {
|
|
110506
|
-
return currentLineMap || (currentLineMap = ts.getLineStarts(currentSourceFile));
|
|
110507
|
+
return currentLineMap || (currentLineMap = ts.getLineStarts(ts.Debug.checkDefined(currentSourceFile)));
|
|
110507
110508
|
}
|
|
110508
110509
|
function emit(node, parenthesizerRule) {
|
|
110509
110510
|
if (node === undefined)
|
|
@@ -111678,7 +111679,7 @@ var ts;
|
|
|
111678
111679
|
increaseIndent();
|
|
111679
111680
|
}
|
|
111680
111681
|
var preferNewLine = node.multiLine ? 65536 /* PreferNewLine */ : 0 /* None */;
|
|
111681
|
-
var allowTrailingComma = currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
|
|
111682
|
+
var allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 /* ES5 */ && !ts.isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */;
|
|
111682
111683
|
emitList(node, node.properties, 526226 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine);
|
|
111683
111684
|
if (indentedFlag) {
|
|
111684
111685
|
decreaseIndent();
|
|
@@ -112034,7 +112035,7 @@ var ts;
|
|
|
112034
112035
|
emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfExpressionStatement);
|
|
112035
112036
|
// Emit semicolon in non json files
|
|
112036
112037
|
// or if json file that created synthesized expression(eg.define expression statement when --out and amd code generation)
|
|
112037
|
-
if (!ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
|
|
112038
|
+
if (!currentSourceFile || !ts.isJsonSourceFile(currentSourceFile) || ts.nodeIsSynthesized(node.expression)) {
|
|
112038
112039
|
writeTrailingSemicolon();
|
|
112039
112040
|
}
|
|
112040
112041
|
}
|
|
@@ -112327,7 +112328,7 @@ var ts;
|
|
|
112327
112328
|
if (body.multiLine) {
|
|
112328
112329
|
return false;
|
|
112329
112330
|
}
|
|
112330
|
-
if (!ts.nodeIsSynthesized(body) && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
|
|
112331
|
+
if (!ts.nodeIsSynthesized(body) && currentSourceFile && !ts.rangeIsOnSingleLine(body, currentSourceFile)) {
|
|
112331
112332
|
return false;
|
|
112332
112333
|
}
|
|
112333
112334
|
if (getLeadingLineTerminatorCount(body, body.statements, 2 /* PreserveLines */)
|
|
@@ -112352,12 +112353,7 @@ var ts;
|
|
|
112352
112353
|
var emitBlockFunctionBody = shouldEmitBlockFunctionBodyOnSingleLine(body)
|
|
112353
112354
|
? emitBlockFunctionBodyOnSingleLine
|
|
112354
112355
|
: emitBlockFunctionBodyWorker;
|
|
112355
|
-
|
|
112356
|
-
emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
|
|
112357
|
-
}
|
|
112358
|
-
else {
|
|
112359
|
-
emitBlockFunctionBody(body);
|
|
112360
|
-
}
|
|
112356
|
+
emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody);
|
|
112361
112357
|
decreaseIndent();
|
|
112362
112358
|
writeToken(19 /* CloseBraceToken */, body.statements.end, writePunctuation, body);
|
|
112363
112359
|
onAfterEmitNode === null || onAfterEmitNode === void 0 ? void 0 : onAfterEmitNode(body);
|
|
@@ -112754,7 +112750,8 @@ var ts;
|
|
|
112754
112750
|
var emitAsSingleStatement = statements.length === 1 &&
|
|
112755
112751
|
(
|
|
112756
112752
|
// treat synthesized nodes as located on the same line for emit purposes
|
|
112757
|
-
|
|
112753
|
+
!currentSourceFile ||
|
|
112754
|
+
ts.nodeIsSynthesized(parentNode) ||
|
|
112758
112755
|
ts.nodeIsSynthesized(statements[0]) ||
|
|
112759
112756
|
ts.rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile));
|
|
112760
112757
|
var format = 163969 /* CaseOrDefaultClauseStatements */;
|
|
@@ -112985,16 +112982,14 @@ var ts;
|
|
|
112985
112982
|
function emitSourceFile(node) {
|
|
112986
112983
|
writeLine();
|
|
112987
112984
|
var statements = node.statements;
|
|
112988
|
-
if
|
|
112989
|
-
|
|
112990
|
-
|
|
112991
|
-
|
|
112992
|
-
|
|
112993
|
-
|
|
112994
|
-
|
|
112995
|
-
|
|
112996
|
-
return;
|
|
112997
|
-
}
|
|
112985
|
+
// Emit detached comment if there are no prologue directives or if the first node is synthesized.
|
|
112986
|
+
// The synthesized node will have no leading comment so some comments may be missed.
|
|
112987
|
+
var shouldEmitDetachedComment = statements.length === 0 ||
|
|
112988
|
+
!ts.isPrologueDirective(statements[0]) ||
|
|
112989
|
+
ts.nodeIsSynthesized(statements[0]);
|
|
112990
|
+
if (shouldEmitDetachedComment) {
|
|
112991
|
+
emitBodyWithDetachedComments(node, statements, emitSourceFileWorker);
|
|
112992
|
+
return;
|
|
112998
112993
|
}
|
|
112999
112994
|
emitSourceFileWorker(node);
|
|
113000
112995
|
}
|
|
@@ -113383,7 +113378,7 @@ var ts;
|
|
|
113383
113378
|
}
|
|
113384
113379
|
if (isEmpty) {
|
|
113385
113380
|
// Write a line terminator if the parent node was multi-line
|
|
113386
|
-
if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
|
|
113381
|
+
if (format & 1 /* MultiLine */ && !(preserveSourceNewlines && (!parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile)))) {
|
|
113387
113382
|
writeLine();
|
|
113388
113383
|
}
|
|
113389
113384
|
else if (format & 256 /* SpaceBetweenBraces */ && !(format & 524288 /* NoSpaceIfEmpty */)) {
|
|
@@ -113644,7 +113639,7 @@ var ts;
|
|
|
113644
113639
|
}
|
|
113645
113640
|
var firstChild_1 = children[0];
|
|
113646
113641
|
if (firstChild_1 === undefined) {
|
|
113647
|
-
return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113642
|
+
return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113648
113643
|
}
|
|
113649
113644
|
if (firstChild_1.pos === nextListElementPos) {
|
|
113650
113645
|
// If this child starts at the beginning of a list item in a parent list, its leading
|
|
@@ -113668,7 +113663,7 @@ var ts;
|
|
|
113668
113663
|
// JsxText will be written with its leading whitespace, so don't add more manually.
|
|
113669
113664
|
return 0;
|
|
113670
113665
|
}
|
|
113671
|
-
if (parentNode &&
|
|
113666
|
+
if (currentSourceFile && parentNode &&
|
|
113672
113667
|
!ts.positionIsSynthesized(parentNode.pos) &&
|
|
113673
113668
|
!ts.nodeIsSynthesized(firstChild_1) &&
|
|
113674
113669
|
(!firstChild_1.parent || ts.getOriginalNode(firstChild_1.parent) === ts.getOriginalNode(parentNode))) {
|
|
@@ -113692,7 +113687,7 @@ var ts;
|
|
|
113692
113687
|
// JsxText will be written with its leading whitespace, so don't add more manually.
|
|
113693
113688
|
return 0;
|
|
113694
113689
|
}
|
|
113695
|
-
else if (!ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
|
|
113690
|
+
else if (currentSourceFile && !ts.nodeIsSynthesized(previousNode) && !ts.nodeIsSynthesized(nextNode)) {
|
|
113696
113691
|
if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) {
|
|
113697
113692
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(previousNode, nextNode, currentSourceFile, includeComments); });
|
|
113698
113693
|
}
|
|
@@ -113724,9 +113719,9 @@ var ts;
|
|
|
113724
113719
|
}
|
|
113725
113720
|
var lastChild = ts.lastOrUndefined(children);
|
|
113726
113721
|
if (lastChild === undefined) {
|
|
113727
|
-
return !parentNode || ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113722
|
+
return !parentNode || currentSourceFile && ts.rangeIsOnSingleLine(parentNode, currentSourceFile) ? 0 : 1;
|
|
113728
113723
|
}
|
|
113729
|
-
if (parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
|
|
113724
|
+
if (currentSourceFile && parentNode && !ts.positionIsSynthesized(parentNode.pos) && !ts.nodeIsSynthesized(lastChild) && (!lastChild.parent || lastChild.parent === parentNode)) {
|
|
113730
113725
|
if (preserveSourceNewlines) {
|
|
113731
113726
|
var end_1 = ts.isNodeArray(children) && !ts.positionIsSynthesized(children.end) ? children.end : lastChild.end;
|
|
113732
113727
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter(end_1, parentNode.end, currentSourceFile, includeComments); });
|
|
@@ -113799,7 +113794,7 @@ var ts;
|
|
|
113799
113794
|
if (ts.getStartsOnNewLine(node2)) {
|
|
113800
113795
|
return 1;
|
|
113801
113796
|
}
|
|
113802
|
-
if (!ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
|
|
113797
|
+
if (currentSourceFile && !ts.nodeIsSynthesized(parent) && !ts.nodeIsSynthesized(node1) && !ts.nodeIsSynthesized(node2)) {
|
|
113803
113798
|
if (preserveSourceNewlines) {
|
|
113804
113799
|
return getEffectiveLines(function (includeComments) { return ts.getLinesBetweenRangeEndAndRangeStart(node1, node2, currentSourceFile, includeComments); });
|
|
113805
113800
|
}
|
|
@@ -113809,7 +113804,7 @@ var ts;
|
|
|
113809
113804
|
}
|
|
113810
113805
|
function isEmptyBlock(block) {
|
|
113811
113806
|
return block.statements.length === 0
|
|
113812
|
-
&& ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
|
|
113807
|
+
&& (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile));
|
|
113813
113808
|
}
|
|
113814
113809
|
function skipSynthesizedParentheses(node) {
|
|
113815
113810
|
while (node.kind === 212 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
|
|
@@ -113821,16 +113816,23 @@ var ts;
|
|
|
113821
113816
|
if (ts.isGeneratedIdentifier(node)) {
|
|
113822
113817
|
return generateName(node);
|
|
113823
113818
|
}
|
|
113824
|
-
|
|
113825
|
-
return ts.idText(node);
|
|
113826
|
-
}
|
|
113827
|
-
else if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
|
|
113819
|
+
if (ts.isStringLiteral(node) && node.textSourceNode) {
|
|
113828
113820
|
return getTextOfNode(node.textSourceNode, includeTrivia);
|
|
113829
113821
|
}
|
|
113830
|
-
|
|
113831
|
-
|
|
113822
|
+
var sourceFile = currentSourceFile; // const needed for control flow
|
|
113823
|
+
var canUseSourceFile = !!sourceFile && !!node.parent && !ts.nodeIsSynthesized(node);
|
|
113824
|
+
if (ts.isMemberName(node)) {
|
|
113825
|
+
if (!canUseSourceFile || ts.getSourceFileOfNode(node) !== ts.getOriginalNode(sourceFile)) {
|
|
113826
|
+
return ts.idText(node);
|
|
113827
|
+
}
|
|
113832
113828
|
}
|
|
113833
|
-
|
|
113829
|
+
else {
|
|
113830
|
+
ts.Debug.assertNode(node, ts.isLiteralExpression); // not strictly necessary
|
|
113831
|
+
if (!canUseSourceFile) {
|
|
113832
|
+
return node.text;
|
|
113833
|
+
}
|
|
113834
|
+
}
|
|
113835
|
+
return ts.getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia);
|
|
113834
113836
|
}
|
|
113835
113837
|
function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
|
|
113836
113838
|
if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) {
|
|
@@ -114409,7 +114411,7 @@ var ts;
|
|
|
114409
114411
|
return true;
|
|
114410
114412
|
}
|
|
114411
114413
|
function emitLeadingComment(commentPos, commentEnd, kind, hasTrailingNewLine, rangePos) {
|
|
114412
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114414
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114413
114415
|
return;
|
|
114414
114416
|
if (!hasWrittenComment) {
|
|
114415
114417
|
ts.emitNewLineBeforeLeadingCommentOfPosition(getCurrentLineMap(), writer, rangePos, commentPos);
|
|
@@ -114436,7 +114438,7 @@ var ts;
|
|
|
114436
114438
|
forEachTrailingCommentToEmit(pos, emitTrailingComment);
|
|
114437
114439
|
}
|
|
114438
114440
|
function emitTrailingComment(commentPos, commentEnd, _kind, hasTrailingNewLine) {
|
|
114439
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114441
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114440
114442
|
return;
|
|
114441
114443
|
// trailing comments are emitted at space/*trailing comment1 */space/*trailing comment2*/
|
|
114442
114444
|
if (!writer.isAtStartOfLine()) {
|
|
@@ -114458,6 +114460,8 @@ var ts;
|
|
|
114458
114460
|
exitComment();
|
|
114459
114461
|
}
|
|
114460
114462
|
function emitTrailingCommentOfPositionNoNewline(commentPos, commentEnd, kind) {
|
|
114463
|
+
if (!currentSourceFile)
|
|
114464
|
+
return;
|
|
114461
114465
|
// trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
|
|
114462
114466
|
emitPos(commentPos);
|
|
114463
114467
|
ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
|
|
@@ -114467,6 +114471,8 @@ var ts;
|
|
|
114467
114471
|
}
|
|
114468
114472
|
}
|
|
114469
114473
|
function emitTrailingCommentOfPosition(commentPos, commentEnd, _kind, hasTrailingNewLine) {
|
|
114474
|
+
if (!currentSourceFile)
|
|
114475
|
+
return;
|
|
114470
114476
|
// trailing comments of a position are emitted at /*trailing comment1 */space/*trailing comment*/space
|
|
114471
114477
|
emitPos(commentPos);
|
|
114472
114478
|
ts.writeCommentRange(currentSourceFile.text, getCurrentLineMap(), writer, commentPos, commentEnd, newLine);
|
|
@@ -114499,6 +114505,8 @@ var ts;
|
|
|
114499
114505
|
return detachedCommentsInfo !== undefined && ts.last(detachedCommentsInfo).nodePos === pos;
|
|
114500
114506
|
}
|
|
114501
114507
|
function forEachLeadingCommentWithoutDetachedComments(cb) {
|
|
114508
|
+
if (!currentSourceFile)
|
|
114509
|
+
return;
|
|
114502
114510
|
// get the leading comments from detachedPos
|
|
114503
114511
|
var pos = ts.last(detachedCommentsInfo).detachedCommentEndPos;
|
|
114504
114512
|
if (detachedCommentsInfo.length - 1) {
|
|
@@ -114510,7 +114518,7 @@ var ts;
|
|
|
114510
114518
|
ts.forEachLeadingCommentRange(currentSourceFile.text, pos, cb, /*state*/ pos);
|
|
114511
114519
|
}
|
|
114512
114520
|
function emitDetachedCommentsAndUpdateCommentsInfo(range) {
|
|
114513
|
-
var currentDetachedCommentInfo = ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
|
|
114521
|
+
var currentDetachedCommentInfo = currentSourceFile && ts.emitDetachedComments(currentSourceFile.text, getCurrentLineMap(), writer, emitComment, range, newLine, commentsDisabled);
|
|
114514
114522
|
if (currentDetachedCommentInfo) {
|
|
114515
114523
|
if (detachedCommentsInfo) {
|
|
114516
114524
|
detachedCommentsInfo.push(currentDetachedCommentInfo);
|
|
@@ -114521,7 +114529,7 @@ var ts;
|
|
|
114521
114529
|
}
|
|
114522
114530
|
}
|
|
114523
114531
|
function emitComment(text, lineMap, writer, commentPos, commentEnd, newLine) {
|
|
114524
|
-
if (!shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114532
|
+
if (!currentSourceFile || !shouldWriteComment(currentSourceFile.text, commentPos))
|
|
114525
114533
|
return;
|
|
114526
114534
|
emitPos(commentPos);
|
|
114527
114535
|
ts.writeCommentRange(text, lineMap, writer, commentPos, commentEnd, newLine);
|
|
@@ -114533,7 +114541,7 @@ var ts;
|
|
|
114533
114541
|
* @return true if the comment is a triple-slash comment else false
|
|
114534
114542
|
*/
|
|
114535
114543
|
function isTripleSlashComment(commentPos, commentEnd) {
|
|
114536
|
-
return ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
|
|
114544
|
+
return !!currentSourceFile && ts.isRecognizedTripleSlashComment(currentSourceFile.text, commentPos, commentEnd);
|
|
114537
114545
|
}
|
|
114538
114546
|
// Source Maps
|
|
114539
114547
|
function getParsedSourceMap(node) {
|
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.7.0-dev.
|
|
5
|
+
"version": "4.7.0-dev.20220423",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|