Skip to content

Commit 9983da0

Browse files
committed
feat(typescript): update to typescript 3.6.2
1 parent c99e90c commit 9983da0

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"vermoji": "node scripts/vermoji.js"
5858
},
5959
"dependencies": {
60-
"typescript": "3.5.3"
60+
"typescript": "3.6.2"
6161
},
6262
"devDependencies": {
6363
"@types/autoprefixer": "^9.1.1",

src/utils/logger/logger-typescript.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const loadTypeScriptDiagnostic = (tsDiagnostic: ts.Diagnostic) => {
9292
language: 'typescript',
9393
header: 'TypeScript',
9494
code: tsDiagnostic.code.toString(),
95-
messageText: formatMessageText(tsDiagnostic),
95+
messageText: flattenDiagnosticMessageText(tsDiagnostic, tsDiagnostic.messageText),
9696
relFilePath: null,
9797
absFilePath: null,
9898
lines: []
@@ -157,11 +157,11 @@ export const loadTypeScriptDiagnostic = (tsDiagnostic: ts.Diagnostic) => {
157157
};
158158

159159

160-
const formatMessageText = (tsDiagnostic: ts.Diagnostic) => {
161-
let diagnosticChain = tsDiagnostic.messageText;
162-
163-
if (typeof diagnosticChain === 'string') {
164-
return diagnosticChain;
160+
const flattenDiagnosticMessageText = (tsDiagnostic: ts.Diagnostic, diag: string | ts.DiagnosticMessageChain | undefined) => {
161+
if (typeof diag === 'string') {
162+
return diag;
163+
} else if (diag === undefined) {
164+
return '';
165165
}
166166

167167
const ignoreCodes: number[] = [];
@@ -171,13 +171,13 @@ const formatMessageText = (tsDiagnostic: ts.Diagnostic) => {
171171
}
172172

173173
let result = '';
174-
175-
while (diagnosticChain) {
176-
if (!ignoreCodes.includes(diagnosticChain.code)) {
177-
result += diagnosticChain.messageText + ' ';
174+
if (!ignoreCodes.includes(diag.code)) {
175+
result = diag.messageText;
176+
if (diag.next) {
177+
for (const kid of diag.next) {
178+
result += flattenDiagnosticMessageText(tsDiagnostic, kid);
179+
}
178180
}
179-
180-
diagnosticChain = diagnosticChain.next;
181181
}
182182

183183
if (isStencilConfig) {

0 commit comments

Comments
 (0)