@typescript-deploys/pr-build 4.6.0-pr-47183-2 → 4.6.0-pr-47126-2
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.es2020.intl.d.ts +1 -0
- package/lib/tsc.js +109 -71
- package/lib/tsserver.js +254 -130
- package/lib/tsserverlibrary.d.ts +6 -4
- package/lib/tsserverlibrary.js +225 -129
- package/lib/typescript.d.ts +5 -4
- package/lib/typescript.js +221 -128
- package/lib/typescriptServices.d.ts +5 -4
- package/lib/typescriptServices.js +221 -128
- package/lib/typingsInstaller.js +164 -99
- 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-insiders.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220107";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -22231,7 +22231,7 @@ var ts;
|
|
|
22231
22231
|
result.push(createModifier(144 /* ReadonlyKeyword */));
|
|
22232
22232
|
if (flags & 256 /* Async */)
|
|
22233
22233
|
result.push(createModifier(131 /* AsyncKeyword */));
|
|
22234
|
-
return result;
|
|
22234
|
+
return result.length ? result : undefined;
|
|
22235
22235
|
}
|
|
22236
22236
|
//
|
|
22237
22237
|
// Names
|
|
@@ -26188,32 +26188,36 @@ var ts;
|
|
|
26188
26188
|
}
|
|
26189
26189
|
function updateModifiers(node, modifiers) {
|
|
26190
26190
|
var _a;
|
|
26191
|
+
var modifierArray;
|
|
26191
26192
|
if (typeof modifiers === "number") {
|
|
26192
|
-
|
|
26193
|
-
}
|
|
26194
|
-
|
|
26195
|
-
|
|
26196
|
-
|
|
26197
|
-
|
|
26198
|
-
|
|
26199
|
-
|
|
26200
|
-
|
|
26201
|
-
|
|
26202
|
-
|
|
26203
|
-
|
|
26204
|
-
|
|
26205
|
-
|
|
26206
|
-
|
|
26207
|
-
|
|
26208
|
-
|
|
26209
|
-
|
|
26210
|
-
|
|
26211
|
-
|
|
26212
|
-
|
|
26213
|
-
|
|
26214
|
-
|
|
26215
|
-
|
|
26216
|
-
|
|
26193
|
+
modifierArray = createModifiersFromModifierFlags(modifiers);
|
|
26194
|
+
}
|
|
26195
|
+
else {
|
|
26196
|
+
modifierArray = modifiers;
|
|
26197
|
+
}
|
|
26198
|
+
return ts.isParameter(node) ? updateParameterDeclaration(node, node.decorators, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) :
|
|
26199
|
+
ts.isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) :
|
|
26200
|
+
ts.isPropertyDeclaration(node) ? updatePropertyDeclaration(node, node.decorators, modifierArray, node.name, (_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, node.type, node.initializer) :
|
|
26201
|
+
ts.isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) :
|
|
26202
|
+
ts.isMethodDeclaration(node) ? updateMethodDeclaration(node, node.decorators, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) :
|
|
26203
|
+
ts.isConstructorDeclaration(node) ? updateConstructorDeclaration(node, node.decorators, modifierArray, node.parameters, node.body) :
|
|
26204
|
+
ts.isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, node.decorators, modifierArray, node.name, node.parameters, node.type, node.body) :
|
|
26205
|
+
ts.isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, node.decorators, modifierArray, node.name, node.parameters, node.body) :
|
|
26206
|
+
ts.isIndexSignatureDeclaration(node) ? updateIndexSignature(node, node.decorators, modifierArray, node.parameters, node.type) :
|
|
26207
|
+
ts.isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) :
|
|
26208
|
+
ts.isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) :
|
|
26209
|
+
ts.isClassExpression(node) ? updateClassExpression(node, node.decorators, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) :
|
|
26210
|
+
ts.isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) :
|
|
26211
|
+
ts.isFunctionDeclaration(node) ? updateFunctionDeclaration(node, node.decorators, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) :
|
|
26212
|
+
ts.isClassDeclaration(node) ? updateClassDeclaration(node, node.decorators, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) :
|
|
26213
|
+
ts.isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, node.decorators, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) :
|
|
26214
|
+
ts.isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, node.decorators, modifierArray, node.name, node.typeParameters, node.type) :
|
|
26215
|
+
ts.isEnumDeclaration(node) ? updateEnumDeclaration(node, node.decorators, modifierArray, node.name, node.members) :
|
|
26216
|
+
ts.isModuleDeclaration(node) ? updateModuleDeclaration(node, node.decorators, modifierArray, node.name, node.body) :
|
|
26217
|
+
ts.isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, node.decorators, modifierArray, node.isTypeOnly, node.name, node.moduleReference) :
|
|
26218
|
+
ts.isImportDeclaration(node) ? updateImportDeclaration(node, node.decorators, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) :
|
|
26219
|
+
ts.isExportAssignment(node) ? updateExportAssignment(node, node.decorators, modifierArray, node.expression) :
|
|
26220
|
+
ts.isExportDeclaration(node) ? updateExportDeclaration(node, node.decorators, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) :
|
|
26217
26221
|
ts.Debug.assertNever(node);
|
|
26218
26222
|
}
|
|
26219
26223
|
function asNodeArray(array) {
|
|
@@ -57713,7 +57717,7 @@ var ts;
|
|
|
57713
57717
|
return symbol_1;
|
|
57714
57718
|
}
|
|
57715
57719
|
}
|
|
57716
|
-
return
|
|
57720
|
+
return getPropertyOfObjectType(globalObjectType, name);
|
|
57717
57721
|
}
|
|
57718
57722
|
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
57719
57723
|
return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment);
|
|
@@ -67426,7 +67430,8 @@ var ts;
|
|
|
67426
67430
|
return access.kind === 205 /* PropertyAccessExpression */ ? access.name.escapedText :
|
|
67427
67431
|
access.kind === 206 /* ElementAccessExpression */ && ts.isStringOrNumericLiteralLike(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
|
|
67428
67432
|
access.kind === 202 /* BindingElement */ && (propertyName = getDestructuringPropertyName(access)) ? ts.escapeLeadingUnderscores(propertyName) :
|
|
67429
|
-
|
|
67433
|
+
access.kind === 163 /* Parameter */ ? ("" + access.parent.parameters.indexOf(access)) :
|
|
67434
|
+
undefined;
|
|
67430
67435
|
}
|
|
67431
67436
|
function containsMatchingReference(source, target) {
|
|
67432
67437
|
while (ts.isAccessExpression(source)) {
|
|
@@ -68766,13 +68771,14 @@ var ts;
|
|
|
68766
68771
|
return result;
|
|
68767
68772
|
}
|
|
68768
68773
|
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
68769
|
-
if (ts.isBindingPattern(reference)) {
|
|
68770
|
-
// When the reference is a binding pattern, we are narrowing a pesudo-reference in
|
|
68771
|
-
// An identifier for a destructuring variable declared in the same binding pattern
|
|
68774
|
+
if (ts.isBindingPattern(reference) || ts.isFunctionExpressionOrArrowFunction(reference)) {
|
|
68775
|
+
// When the reference is a binding pattern or function or arrow expression, we are narrowing a pesudo-reference in
|
|
68776
|
+
// getNarrowedTypeOfSymbol. An identifier for a destructuring variable declared in the same binding pattern or
|
|
68777
|
+
// parameter declared in the same parameter list is a candidate.
|
|
68772
68778
|
if (ts.isIdentifier(expr)) {
|
|
68773
68779
|
var symbol = getResolvedSymbol(expr);
|
|
68774
68780
|
var declaration = symbol.valueDeclaration;
|
|
68775
|
-
if (declaration && ts.isBindingElement(declaration) &&
|
|
68781
|
+
if (declaration && (ts.isBindingElement(declaration) || ts.isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
68776
68782
|
return declaration;
|
|
68777
68783
|
}
|
|
68778
68784
|
}
|
|
@@ -69574,42 +69580,78 @@ var ts;
|
|
|
69574
69580
|
}
|
|
69575
69581
|
}
|
|
69576
69582
|
function getNarrowedTypeOfSymbol(symbol, location) {
|
|
69577
|
-
// If we have a non-rest binding element with no initializer declared as a const variable or a const-like
|
|
69578
|
-
// parameter (a parameter for which there are no assignments in the function body), and if the parent type
|
|
69579
|
-
// for the destructuring is a union type, one or more of the binding elements may represent discriminant
|
|
69580
|
-
// properties, and we want the effects of conditional checks on such discriminants to affect the types of
|
|
69581
|
-
// other binding elements from the same destructuring. Consider:
|
|
69582
|
-
//
|
|
69583
|
-
// type Action =
|
|
69584
|
-
// | { kind: 'A', payload: number }
|
|
69585
|
-
// | { kind: 'B', payload: string };
|
|
69586
|
-
//
|
|
69587
|
-
// function f1({ kind, payload }: Action) {
|
|
69588
|
-
// if (kind === 'A') {
|
|
69589
|
-
// payload.toFixed();
|
|
69590
|
-
// }
|
|
69591
|
-
// if (kind === 'B') {
|
|
69592
|
-
// payload.toUpperCase();
|
|
69593
|
-
// }
|
|
69594
|
-
// }
|
|
69595
|
-
//
|
|
69596
|
-
// Above, we want the conditional checks on 'kind' to affect the type of 'payload'. To facilitate this, we use
|
|
69597
|
-
// the binding pattern AST instance for '{ kind, payload }' as a pseudo-reference and narrow this reference
|
|
69598
|
-
// as if it occurred in the specified location. We then recompute the narrowed binding element type by
|
|
69599
|
-
// destructuring from the narrowed parent type.
|
|
69600
69583
|
var declaration = symbol.valueDeclaration;
|
|
69601
|
-
if (declaration
|
|
69602
|
-
|
|
69603
|
-
|
|
69604
|
-
|
|
69605
|
-
|
|
69606
|
-
|
|
69607
|
-
|
|
69608
|
-
|
|
69609
|
-
|
|
69610
|
-
|
|
69611
|
-
|
|
69612
|
-
|
|
69584
|
+
if (declaration) {
|
|
69585
|
+
// If we have a non-rest binding element with no initializer declared as a const variable or a const-like
|
|
69586
|
+
// parameter (a parameter for which there are no assignments in the function body), and if the parent type
|
|
69587
|
+
// for the destructuring is a union type, one or more of the binding elements may represent discriminant
|
|
69588
|
+
// properties, and we want the effects of conditional checks on such discriminants to affect the types of
|
|
69589
|
+
// other binding elements from the same destructuring. Consider:
|
|
69590
|
+
//
|
|
69591
|
+
// type Action =
|
|
69592
|
+
// | { kind: 'A', payload: number }
|
|
69593
|
+
// | { kind: 'B', payload: string };
|
|
69594
|
+
//
|
|
69595
|
+
// function f({ kind, payload }: Action) {
|
|
69596
|
+
// if (kind === 'A') {
|
|
69597
|
+
// payload.toFixed();
|
|
69598
|
+
// }
|
|
69599
|
+
// if (kind === 'B') {
|
|
69600
|
+
// payload.toUpperCase();
|
|
69601
|
+
// }
|
|
69602
|
+
// }
|
|
69603
|
+
//
|
|
69604
|
+
// Above, we want the conditional checks on 'kind' to affect the type of 'payload'. To facilitate this, we use
|
|
69605
|
+
// the binding pattern AST instance for '{ kind, payload }' as a pseudo-reference and narrow this reference
|
|
69606
|
+
// as if it occurred in the specified location. We then recompute the narrowed binding element type by
|
|
69607
|
+
// destructuring from the narrowed parent type.
|
|
69608
|
+
if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
69609
|
+
var parent = declaration.parent.parent;
|
|
69610
|
+
if (parent.kind === 253 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 163 /* Parameter */) {
|
|
69611
|
+
var links = getNodeLinks(location);
|
|
69612
|
+
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
69613
|
+
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
69614
|
+
var parentType = getTypeForBindingElementParent(parent);
|
|
69615
|
+
links.flags &= ~268435456 /* InCheckIdentifier */;
|
|
69616
|
+
if (parentType && parentType.flags & 1048576 /* Union */ && !(parent.kind === 163 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
69617
|
+
var pattern = declaration.parent;
|
|
69618
|
+
var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode);
|
|
69619
|
+
return getBindingElementTypeFromParentType(declaration, narrowedType);
|
|
69620
|
+
}
|
|
69621
|
+
}
|
|
69622
|
+
}
|
|
69623
|
+
}
|
|
69624
|
+
// If we have a const-like parameter with no type annotation or initializer, and if the parameter is contextually
|
|
69625
|
+
// typed by a signature with a single rest parameter of a union of tuple types, one or more of the parameters may
|
|
69626
|
+
// represent discriminant tuple elements, and we want the effects of conditional checks on such discriminants to
|
|
69627
|
+
// affect the types of other parameters in the same parameter list. Consider:
|
|
69628
|
+
//
|
|
69629
|
+
// type Action = [kind: 'A', payload: number] | [kind: 'B', payload: string];
|
|
69630
|
+
//
|
|
69631
|
+
// const f: (...args: Action) => void = (kind, payload) => {
|
|
69632
|
+
// if (kind === 'A') {
|
|
69633
|
+
// payload.toFixed();
|
|
69634
|
+
// }
|
|
69635
|
+
// if (kind === 'B') {
|
|
69636
|
+
// payload.toUpperCase();
|
|
69637
|
+
// }
|
|
69638
|
+
// }
|
|
69639
|
+
//
|
|
69640
|
+
// Above, we want the conditional checks on 'kind' to affect the type of 'payload'. To facilitate this, we use
|
|
69641
|
+
// the arrow function AST node for '(kind, payload) => ...' as a pseudo-reference and narrow this reference as
|
|
69642
|
+
// if it occurred in the specified location. We then recompute the narrowed parameter type by indexing into the
|
|
69643
|
+
// narrowed tuple type.
|
|
69644
|
+
if (ts.isParameter(declaration) && !declaration.type && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
69645
|
+
var func = declaration.parent;
|
|
69646
|
+
if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
|
|
69647
|
+
var contextualSignature = getContextualSignature(func);
|
|
69648
|
+
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
69649
|
+
var restType = getTypeOfSymbol(contextualSignature.parameters[0]);
|
|
69650
|
+
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) {
|
|
69651
|
+
var narrowedType = getFlowTypeOfReference(func, restType, restType, /*flowContainer*/ undefined, location.flowNode);
|
|
69652
|
+
var index = func.parameters.indexOf(declaration) - (ts.getThisParameter(func) ? 1 : 0);
|
|
69653
|
+
return getIndexedAccessType(narrowedType, getNumberLiteralType(index));
|
|
69654
|
+
}
|
|
69613
69655
|
}
|
|
69614
69656
|
}
|
|
69615
69657
|
}
|
|
@@ -109007,7 +109049,7 @@ var ts;
|
|
|
109007
109049
|
emitPlaceholder(hint, node, snippet);
|
|
109008
109050
|
break;
|
|
109009
109051
|
case 0 /* TabStop */:
|
|
109010
|
-
emitTabStop(snippet);
|
|
109052
|
+
emitTabStop(hint, node, snippet);
|
|
109011
109053
|
break;
|
|
109012
109054
|
}
|
|
109013
109055
|
}
|
|
@@ -109017,7 +109059,10 @@ var ts;
|
|
|
109017
109059
|
nonEscapingWrite("}"); // `}`
|
|
109018
109060
|
// `${2:...}`
|
|
109019
109061
|
}
|
|
109020
|
-
function emitTabStop(snippet) {
|
|
109062
|
+
function emitTabStop(hint, node, snippet) {
|
|
109063
|
+
// A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text.
|
|
109064
|
+
ts.Debug.assert(node.kind === 235 /* EmptyStatement */, "A tab stop cannot be attached to a node of kind " + ts.Debug.formatSyntaxKind(node.kind) + ".");
|
|
109065
|
+
ts.Debug.assert(hint !== 5 /* EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement.");
|
|
109021
109066
|
nonEscapingWrite("$" + snippet.order);
|
|
109022
109067
|
}
|
|
109023
109068
|
//
|
|
@@ -113278,8 +113323,8 @@ var ts;
|
|
|
113278
113323
|
var gutterSeparator = " ";
|
|
113279
113324
|
var resetEscapeSequence = "\u001b[0m";
|
|
113280
113325
|
var ellipsis = "...";
|
|
113326
|
+
var bullet = "● ";
|
|
113281
113327
|
var halfIndent = " ";
|
|
113282
|
-
var indent = " ";
|
|
113283
113328
|
function getCategoryFormat(category) {
|
|
113284
113329
|
switch (category) {
|
|
113285
113330
|
case ts.DiagnosticCategory.Error: return ForegroundColorEscapeSequences.Red;
|
|
@@ -113293,7 +113338,7 @@ var ts;
|
|
|
113293
113338
|
return formatStyle + text + resetEscapeSequence;
|
|
113294
113339
|
}
|
|
113295
113340
|
ts.formatColorAndReset = formatColorAndReset;
|
|
113296
|
-
function formatCodeSpan(file, start, length, indent,
|
|
113341
|
+
function formatCodeSpan(file, start, length, indent, underlineColor, host) {
|
|
113297
113342
|
var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character;
|
|
113298
113343
|
var _b = ts.getLineAndCharacterOfPosition(file, start + length), lastLine = _b.line, lastLineChar = _b.character;
|
|
113299
113344
|
var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line;
|
|
@@ -113317,24 +113362,24 @@ var ts;
|
|
|
113317
113362
|
lineContent = ts.trimStringEnd(lineContent); // trim from end
|
|
113318
113363
|
lineContent = lineContent.replace(/\t/g, " "); // convert tabs to single spaces
|
|
113319
113364
|
// Output the gutter and the actual contents of the line.
|
|
113320
|
-
context += indent +
|
|
113365
|
+
context += indent + ts.padLeft("|", gutterWidth) + gutterSeparator;
|
|
113321
113366
|
context += lineContent + host.getNewLine();
|
|
113322
|
-
// Output the gutter and the error span for the line using
|
|
113323
|
-
context += indent +
|
|
113324
|
-
context +=
|
|
113367
|
+
// Output the gutter and the error span for the line using underlines.
|
|
113368
|
+
context += indent + ts.padLeft("", gutterWidth) + gutterSeparator;
|
|
113369
|
+
context += underlineColor;
|
|
113325
113370
|
if (i === firstLine) {
|
|
113326
113371
|
// If we're on the last line, then limit it to the last character of the last line.
|
|
113327
|
-
// Otherwise, we'll just
|
|
113372
|
+
// Otherwise, we'll just underline the rest of the line, giving 'slice' no end position.
|
|
113328
113373
|
var lastCharForLine = i === lastLine ? lastLineChar : undefined;
|
|
113329
113374
|
context += lineContent.slice(0, firstLineChar).replace(/\S/g, " ");
|
|
113330
|
-
context += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "
|
|
113375
|
+
context += lineContent.slice(firstLineChar, lastCharForLine).replace(/./g, "▔");
|
|
113331
113376
|
}
|
|
113332
113377
|
else if (i === lastLine) {
|
|
113333
|
-
context += lineContent.slice(0, lastLineChar).replace(/./g, "
|
|
113378
|
+
context += lineContent.slice(0, lastLineChar).replace(/./g, "▔");
|
|
113334
113379
|
}
|
|
113335
113380
|
else {
|
|
113336
|
-
//
|
|
113337
|
-
context += lineContent.replace(/./g, "
|
|
113381
|
+
// Underline the entire line.
|
|
113382
|
+
context += lineContent.replace(/./g, "▔");
|
|
113338
113383
|
}
|
|
113339
113384
|
context += resetEscapeSequence;
|
|
113340
113385
|
}
|
|
@@ -113355,41 +113400,54 @@ var ts;
|
|
|
113355
113400
|
}
|
|
113356
113401
|
ts.formatLocation = formatLocation;
|
|
113357
113402
|
function formatDiagnosticsWithColorAndContext(diagnostics, host) {
|
|
113403
|
+
var _a, _b;
|
|
113404
|
+
var terminalWidth = (_b = (_a = ts.sys.getWidthOfTerminal) === null || _a === void 0 ? void 0 : _a.call(ts.sys)) !== null && _b !== void 0 ? _b : 0;
|
|
113405
|
+
var indent = terminalWidth < 60 ? "" : halfIndent;
|
|
113358
113406
|
var output = "";
|
|
113359
113407
|
for (var _i = 0, diagnostics_4 = diagnostics; _i < diagnostics_4.length; _i++) {
|
|
113360
113408
|
var diagnostic = diagnostics_4[_i];
|
|
113409
|
+
var diagnosticCode = "TS" + diagnostic.code;
|
|
113361
113410
|
if (diagnostic.file) {
|
|
113362
113411
|
var file = diagnostic.file, start = diagnostic.start;
|
|
113363
|
-
|
|
113364
|
-
|
|
113365
|
-
|
|
113366
|
-
|
|
113367
|
-
|
|
113368
|
-
|
|
113369
|
-
|
|
113412
|
+
var location = formatLocation(file, start, host); // TODO: GH#18217
|
|
113413
|
+
// Get the location string display length without color & escape sequences.
|
|
113414
|
+
var locationLength = location.replace(/\u001b[[0-9]+m/g, "").length;
|
|
113415
|
+
var codeLength = diagnosticCode.length;
|
|
113416
|
+
output += bullet + location;
|
|
113417
|
+
// Separate the error code from the location by a space on thinner terminals
|
|
113418
|
+
// and those of unknown length, or right-align it on wider terminals.
|
|
113419
|
+
var defaultPad = codeLength + 1;
|
|
113420
|
+
var padWidth = terminalWidth < 60 ? defaultPad : terminalWidth - (bullet.length + locationLength + codeLength);
|
|
113421
|
+
if (padWidth < diagnosticCode.length)
|
|
113422
|
+
padWidth = defaultPad;
|
|
113423
|
+
output += ts.padLeft(diagnosticCode, padWidth);
|
|
113424
|
+
output += formatCodeSpan(diagnostic.file, diagnostic.start, diagnostic.length, indent, getCategoryFormat(diagnostic.category), host); // TODO: GH#18217
|
|
113370
113425
|
output += host.getNewLine();
|
|
113371
|
-
output += formatCodeSpan(diagnostic.file, diagnostic.start, diagnostic.length, "", getCategoryFormat(diagnostic.category), host); // TODO: GH#18217
|
|
113372
113426
|
}
|
|
113427
|
+
var diagnosticText = flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine(), 0, /*pretty*/ true);
|
|
113428
|
+
diagnosticText = ts.map(diagnosticText.split(host.getNewLine()), function (text) { return indent + text; }).join(host.getNewLine());
|
|
113429
|
+
output += diagnosticText;
|
|
113430
|
+
output += host.getNewLine();
|
|
113373
113431
|
if (diagnostic.relatedInformation) {
|
|
113374
|
-
|
|
113375
|
-
|
|
113376
|
-
|
|
113432
|
+
for (var _c = 0, _d = diagnostic.relatedInformation; _c < _d.length; _c++) {
|
|
113433
|
+
var _e = _d[_c], file = _e.file, start = _e.start, length_9 = _e.length, messageText = _e.messageText;
|
|
113434
|
+
output += host.getNewLine();
|
|
113435
|
+
output += indent + flattenDiagnosticMessageText(messageText, host.getNewLine(), 0, /*pretty*/ true);
|
|
113436
|
+
output += host.getNewLine();
|
|
113377
113437
|
if (file) {
|
|
113438
|
+
output += indent + formatLocation(file, start, host); // TODO: GH#18217
|
|
113378
113439
|
output += host.getNewLine();
|
|
113379
|
-
output += halfIndent + formatLocation(file, start, host); // TODO: GH#18217
|
|
113380
113440
|
output += formatCodeSpan(file, start, length_9, indent, ForegroundColorEscapeSequences.Cyan, host); // TODO: GH#18217
|
|
113381
113441
|
}
|
|
113382
|
-
output += host.getNewLine();
|
|
113383
|
-
output += indent + flattenDiagnosticMessageText(messageText, host.getNewLine());
|
|
113384
113442
|
}
|
|
113385
113443
|
}
|
|
113386
|
-
output += host.getNewLine();
|
|
113387
113444
|
}
|
|
113388
113445
|
return output;
|
|
113389
113446
|
}
|
|
113390
113447
|
ts.formatDiagnosticsWithColorAndContext = formatDiagnosticsWithColorAndContext;
|
|
113391
|
-
function flattenDiagnosticMessageText(diag, newLine, indent) {
|
|
113448
|
+
function flattenDiagnosticMessageText(diag, newLine, indent, pretty) {
|
|
113392
113449
|
if (indent === void 0) { indent = 0; }
|
|
113450
|
+
if (pretty === void 0) { pretty = false; }
|
|
113393
113451
|
if (ts.isString(diag)) {
|
|
113394
113452
|
return diag;
|
|
113395
113453
|
}
|
|
@@ -113399,9 +113457,16 @@ var ts;
|
|
|
113399
113457
|
var result = "";
|
|
113400
113458
|
if (indent) {
|
|
113401
113459
|
result += newLine;
|
|
113402
|
-
|
|
113403
|
-
|
|
113460
|
+
// If using pretty formatting, the second line shouldn't be indented past the first,
|
|
113461
|
+
// instead separating the two with an extra empty line.
|
|
113462
|
+
var indentsToReplaceWithNewLines = pretty ? 1 : 0;
|
|
113463
|
+
if (indent > indentsToReplaceWithNewLines) {
|
|
113464
|
+
for (var i = indentsToReplaceWithNewLines; i < indent; i++) {
|
|
113465
|
+
result += " ";
|
|
113466
|
+
}
|
|
113404
113467
|
}
|
|
113468
|
+
else
|
|
113469
|
+
result += newLine;
|
|
113405
113470
|
}
|
|
113406
113471
|
result += diag.messageText;
|
|
113407
113472
|
indent++;
|
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.6.0-pr-
|
|
5
|
+
"version": "4.6.0-pr-47126-2",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|