1- export type ErrorType = 'diagnostic' | 'lint' ;
1+ export type ErrorType = 'diagnostic' | 'lint' | 'internal' ;
22export type Severity = 'error' | 'warning' ;
33
44interface NormalizedMessageJson {
@@ -9,11 +9,13 @@ interface NormalizedMessageJson {
99 file ?: string ;
1010 line ?: number ;
1111 character ?: number ;
12+ stack ?: string ;
1213}
1314
1415export class NormalizedMessage {
1516 public static readonly TYPE_DIAGNOSTIC : ErrorType = 'diagnostic' ;
1617 public static readonly TYPE_LINT : ErrorType = 'lint' ;
18+ public static readonly TYPE_INTERNAL : ErrorType = 'internal' ;
1719
1820 // severity types
1921 public static readonly SEVERITY_ERROR : Severity = 'error' ;
@@ -26,6 +28,7 @@ export class NormalizedMessage {
2628 public readonly file ?: string ;
2729 public readonly line ?: number ;
2830 public readonly character ?: number ;
31+ public readonly stack ?: string ;
2932
3033 constructor ( data : NormalizedMessageJson ) {
3134 this . type = data . type ;
@@ -35,6 +38,7 @@ export class NormalizedMessage {
3538 this . file = data . file ;
3639 this . line = data . line ;
3740 this . character = data . character ;
41+ this . stack = data . stack ;
3842 }
3943
4044 public static createFromJSON ( json : NormalizedMessageJson ) {
@@ -73,6 +77,10 @@ export class NormalizedMessage {
7377 messageA . content ,
7478 messageB . content
7579 ) ||
80+ NormalizedMessage . compareOptionalStrings (
81+ messageA . stack ,
82+ messageB . stack
83+ ) ||
7684 0 /* EqualTo */
7785 ) ;
7886 }
@@ -149,7 +157,8 @@ export class NormalizedMessage {
149157 content : this . content ,
150158 file : this . file ,
151159 line : this . line ,
152- character : this . character
160+ character : this . character ,
161+ stack : this . stack
153162 } as NormalizedMessageJson ;
154163 }
155164
@@ -161,6 +170,10 @@ export class NormalizedMessage {
161170 return NormalizedMessage . TYPE_LINT === this . type ;
162171 }
163172
173+ public isInternalType ( ) {
174+ return NormalizedMessage . TYPE_INTERNAL === this . type ;
175+ }
176+
164177 public getFormattedCode ( ) {
165178 return this . isDiagnosticType ( ) ? 'TS' + this . code : this . code ;
166179 }
0 commit comments