77
88import 'dart:js_interop' ;
99
10+ import 'package:meta/meta.dart' ;
11+
1012import 'typescript.types.dart' ;
1113
1214@JS ()
@@ -30,6 +32,14 @@ external bool isTypeReferenceNode(TSNode node);
3032@JS ()
3133external bool isThisTypeNode (TSNode node);
3234
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+
3343@JS ('CompilerOptions' )
3444extension type TSCompilerOptions ._(JSObject _) implements JSObject {
3545 external TSCompilerOptions ({bool ? allowJs, bool ? declaration});
@@ -41,6 +51,51 @@ extension type TSCompilerOptions._(JSObject _) implements JSObject {
4151extension type TSProgram ._(JSObject _) implements JSObject {
4252 external TSSourceFile ? getSourceFile (String file);
4353 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;
4499}
45100
46101@JS ('TypeChecker' )
@@ -62,3 +117,9 @@ extension type TSNodeArrayCallback<T extends JSAny>._(JSObject _)
62117 implements JSObject {
63118 external T ? call (TSNodeArray <TSNode > nodes);
64119}
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