🚧
Still under progress. Soon will be finished.
Description
Internal class to enqueue any error during the analysis. There are two types of errors the analyser can throw:
- Config errors: Errors because of invalid compiler options
- Syntactic/Semantic errors: Errors thrown by the TypeScript compiler when parsing the code
Methods
-
format
codeFormats syntactic and semantic errors found during the analysis
format(errors: Diagnostic[]): string
Parameters
errors Diagnostic[]
Returns
string
:The diagnostics formatted
-
getAll
codeUsed to retrieve all the errors the analyser has encountered
getAll(): Diagnostic[]
Returns
Diagnostic[]
:All the errors
-
isEmpty
codeChecks whether there are errors or not
isEmpty(): boolean
Returns
boolean
:True if there are no errors, otherwise false
-
flatten
codeA message may be a chain of multiple messages. This helps provide better context for an error. This function flattens the chain of messages
flatten(diagnostic: Diagnostic): string
Parameters
diagnostic Diagnostic
The error to flatten
Returns
string
:The messages flattened
-
addOne
codeAdds a new diagnostic error
addOne(node: Node | null | undefined, message: string | DiagnosticMessageChain): void
Parameters
node Node | null | undefined
The node where the error was found
message string | DiagnosticMessageChain
The error message
Returns
void
: -
addMany
codeAdds multiple syntactic/semantic errors
addMany(diagnostics: readonly Diagnostic[]): void
Parameters
diagnostics readonly Diagnostic[]
An array of syntactic/semantic errors
Returns
void
: