7
7
8
8
import 'dart:js_interop' ;
9
9
10
+ import 'package:meta/meta.dart' ;
11
+
10
12
import 'typescript.types.dart' ;
11
13
12
14
@JS ()
@@ -30,6 +32,14 @@ external bool isTypeReferenceNode(TSNode node);
30
32
@JS ()
31
33
external bool isThisTypeNode (TSNode node);
32
34
35
+ @JS ()
36
+ external TSLineAndCharacter getLineAndCharacterOfPosition (
37
+ TSSourceFile sourceFile, int position);
38
+
39
+ @JS ()
40
+ external String flattenDiagnosticMessageText (JSAny ? diag, String newLine,
41
+ [int indent]);
42
+
33
43
@JS ('CompilerOptions' )
34
44
extension type TSCompilerOptions ._(JSObject _) implements JSObject {
35
45
external TSCompilerOptions ({bool ? allowJs, bool ? declaration});
@@ -41,6 +51,51 @@ extension type TSCompilerOptions._(JSObject _) implements JSObject {
41
51
extension type TSProgram ._(JSObject _) implements JSObject {
42
52
external TSSourceFile ? getSourceFile (String file);
43
53
external TSTypeChecker getTypeChecker ();
54
+
55
+ /// Diagnostics related to syntax errors
56
+ external JSArray <TSDiagnosticWithLocation > getSyntacticDiagnostics ([
57
+ TSSourceFile ? sourceFile,
58
+ ]);
59
+
60
+ /// Diagnostics related to type-checking
61
+ external JSArray <TSDiagnostic > getSemanticDiagnostics ([
62
+ TSSourceFile ? sourceFile,
63
+ ]);
64
+
65
+ /// Diagnostics related to the .d.ts file itself
66
+ external JSArray <TSDiagnosticWithLocation > getDeclarationDiagnostics ([
67
+ TSSourceFile ? sourceFile,
68
+ ]);
69
+ }
70
+
71
+ @JS ('DiagnosticRelatedInformation' )
72
+ extension type TSDiagnosticRelatedInformation ._(JSObject _)
73
+ implements JSObject {
74
+ external TSSourceFile ? file;
75
+ external int code;
76
+
77
+ /// [String] or `TSDiagnosticMessageChain` (unimplemented)
78
+ external JSAny messageText;
79
+ external int ? start;
80
+ }
81
+
82
+ @JS ('Diagnostic' )
83
+ extension type TSDiagnostic ._(JSObject _)
84
+ implements TSDiagnosticRelatedInformation {
85
+ external String ? source;
86
+ external JSArray <TSDiagnosticRelatedInformation >? relatedInformation;
87
+
88
+ @doNotStore
89
+ external JSObject ? get reportsUnnecessary;
90
+ @doNotStore
91
+ external JSObject ? get reportsDeprecated;
92
+ }
93
+
94
+ @JS ('DiagnosticWithLocation' )
95
+ extension type TSDiagnosticWithLocation ._(JSObject _) implements TSDiagnostic {
96
+ external TSSourceFile file;
97
+ external int start;
98
+ external int length;
44
99
}
45
100
46
101
@JS ('TypeChecker' )
@@ -62,3 +117,9 @@ extension type TSNodeArrayCallback<T extends JSAny>._(JSObject _)
62
117
implements JSObject {
63
118
external T ? call (TSNodeArray <TSNode > nodes);
64
119
}
120
+
121
+ @JS ('LineAndCharacter' )
122
+ extension type TSLineAndCharacter ._(JSObject _) implements JSObject {
123
+ external JSNumber get line;
124
+ external JSNumber get character;
125
+ }
0 commit comments