parent
72a7194b6c
commit
2e66e74e14
|
@ -289,8 +289,8 @@ namespace ts {
|
|||
gutterWidth = Math.max(ellipsis.length, gutterWidth);
|
||||
}
|
||||
|
||||
context += host.getNewLine();
|
||||
for (let i = firstLine; i <= lastLine; i++) {
|
||||
context += host.getNewLine();
|
||||
// If the error spans over 5 lines, we'll only show the first 2 and last 2 lines,
|
||||
// so we'll skip ahead to the second-to-last line.
|
||||
if (hasMoreThanFiveLines && firstLine + 1 < i && i < lastLine - 1) {
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
[96mtests/cases/compiler/multiLineContextDiagnosticWithPretty.ts[0m:[93m2[0m:[93m5[0m - [91merror[0m[90m TS2322: [0mType '{ a: { b: string; }; }' is not assignable to type '{ c: string; }'.
|
||||
Object literal may only specify known properties, and 'a' does not exist in type '{ c: string; }'.
|
||||
|
||||
[30;47m2[0m a: {
|
||||
[30;47m [0m [91m ~~~~[0m
|
||||
[30;47m3[0m b: '',
|
||||
[30;47m [0m [91m~~~~~~~~~~~~~~[0m
|
||||
[30;47m4[0m }
|
||||
[30;47m [0m [91m~~~~~[0m
|
||||
|
||||
|
||||
|
||||
==== tests/cases/compiler/multiLineContextDiagnosticWithPretty.ts (1 errors) ====
|
||||
const x: {c: string} = {
|
||||
a: {
|
||||
~~~~
|
||||
b: '',
|
||||
~~~~~~~~~~~~~~
|
||||
}
|
||||
~~~~~
|
||||
!!! error TS2322: Type '{ a: { b: string; }; }' is not assignable to type '{ c: string; }'.
|
||||
!!! error TS2322: Object literal may only specify known properties, and 'a' does not exist in type '{ c: string; }'.
|
||||
};
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
//// [multiLineContextDiagnosticWithPretty.ts]
|
||||
const x: {c: string} = {
|
||||
a: {
|
||||
b: '',
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//// [multiLineContextDiagnosticWithPretty.js]
|
||||
var x = {
|
||||
a: {
|
||||
b: ''
|
||||
}
|
||||
};
|
|
@ -0,0 +1,13 @@
|
|||
=== tests/cases/compiler/multiLineContextDiagnosticWithPretty.ts ===
|
||||
const x: {c: string} = {
|
||||
>x : Symbol(x, Decl(multiLineContextDiagnosticWithPretty.ts, 0, 5))
|
||||
>c : Symbol(c, Decl(multiLineContextDiagnosticWithPretty.ts, 0, 10))
|
||||
|
||||
a: {
|
||||
>a : Symbol(a, Decl(multiLineContextDiagnosticWithPretty.ts, 0, 24))
|
||||
|
||||
b: '',
|
||||
>b : Symbol(b, Decl(multiLineContextDiagnosticWithPretty.ts, 1, 8))
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
=== tests/cases/compiler/multiLineContextDiagnosticWithPretty.ts ===
|
||||
const x: {c: string} = {
|
||||
>x : { c: string; }
|
||||
>c : string
|
||||
>{ a: { b: '', }} : { a: { b: string; }; }
|
||||
|
||||
a: {
|
||||
>a : { b: string; }
|
||||
>{ b: '', } : { b: string; }
|
||||
|
||||
b: '',
|
||||
>b : string
|
||||
>'' : ""
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
// @pretty: true
|
||||
const x: {c: string} = {
|
||||
a: {
|
||||
b: '',
|
||||
}
|
||||
};
|
Loading…
Reference in a new issue