mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Removed custom guard and added isArray
This commit is contained in:
@@ -641,16 +641,17 @@ namespace FourSlash {
|
||||
const defs = getDefs();
|
||||
let definitions: ts.DefinitionInfo[] | ReadonlyArray<ts.DefinitionInfo>;
|
||||
let testName: string;
|
||||
if (this.isDefinitionInfoAndBoundSpan(defs)) {
|
||||
|
||||
if (!defs || Array.isArray(defs)) {
|
||||
definitions = defs as ts.DefinitionInfo[] || [];
|
||||
testName = "goToDefinitions";
|
||||
}
|
||||
else {
|
||||
this.verifyDefinitionTextSpan(defs, startMarkerName);
|
||||
|
||||
definitions = defs.definitions;
|
||||
testName = "goToDefinitionsAndBoundSpan";
|
||||
}
|
||||
else {
|
||||
definitions = defs || [];
|
||||
testName = "goToDefinitions";
|
||||
}
|
||||
|
||||
if (endMarkers.length !== definitions.length) {
|
||||
this.raiseError(`${testName} failed - expected to find ${endMarkers.length} definitions but got ${definitions.length}`);
|
||||
@@ -682,10 +683,6 @@ namespace FourSlash {
|
||||
}
|
||||
}
|
||||
|
||||
private isDefinitionInfoAndBoundSpan(definition: ts.DefinitionInfo[] | ts.DefinitionInfoAndBoundSpan | undefined): definition is ts.DefinitionInfoAndBoundSpan {
|
||||
return definition && (<ts.DefinitionInfoAndBoundSpan>definition).definitions !== undefined;
|
||||
}
|
||||
|
||||
public verifyGetEmitOutputForCurrentFile(expected: string): void {
|
||||
const emit = this.languageService.getEmitOutput(this.activeFile.fileName);
|
||||
if (emit.outputFiles.length !== 1) {
|
||||
|
||||
Reference in New Issue
Block a user