mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Improve error message for JSXExpressions that are comma expressions
This commit is contained in:
@@ -582,6 +582,20 @@ namespace FourSlash {
|
||||
});
|
||||
}
|
||||
|
||||
public verifyErrorExistsAtRange(range: Range, code: number) {
|
||||
const span = ts.createTextSpanFromRange(range);
|
||||
const hasMatchingError = ts.some(
|
||||
this.getDiagnostics(range.fileName),
|
||||
({ code, start, length }) =>
|
||||
code === code &&
|
||||
ts.isNumber(start) && ts.isNumber(length) &&
|
||||
ts.textSpansEqual(span, { start, length }));
|
||||
|
||||
if (!hasMatchingError) {
|
||||
this.raiseError(`No error with code ${code} found at provided range.`);
|
||||
}
|
||||
}
|
||||
|
||||
public verifyNumberOfErrorsInCurrentFile(expected: number) {
|
||||
const errors = this.getDiagnostics(this.activeFile.fileName);
|
||||
const actual = errors.length;
|
||||
@@ -3968,6 +3982,10 @@ namespace FourSlashInterface {
|
||||
this.state.verifyNoErrors();
|
||||
}
|
||||
|
||||
public errorExistsAtRange(range: FourSlash.Range, code: number) {
|
||||
this.state.verifyErrorExistsAtRange(range, code);
|
||||
}
|
||||
|
||||
public numberOfErrorsInCurrentFile(expected: number) {
|
||||
this.state.verifyNumberOfErrorsInCurrentFile(expected);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user