mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-11-18 20:11:14 +00:00
Use an explicit type
This commit is contained in:
1 parent
6122e92802
commit
6c19c13094
4 files changed
+14
-7
No files matched your search
@@ -1158,10 +1158,11 @@ namespace ts {
|
||||
function getValidSourceFile(fileName: string): SourceFile {
|
||||
const sourceFile = program.getSourceFile(fileName);
|
||||
if (!sourceFile) {
|
||||
let error = new Error(`Could not find sourceFile: '${fileName}'.`);
|
||||
const error: Error & PossibleProgramFileInfo = new Error(`Could not find sourceFile: '${fileName}'.`);
|
||||
|
||||
// Attach sidecar data for the server log
|
||||
(error as any)["ProgramFiles"] = program && JSON.stringify(program.getSourceFiles().map(f => f.fileName));
|
||||
// We've been having trouble debugging this, so attach sidecar data for the tsserver log.
|
||||
// See https://github.com/microsoft/TypeScript/issues/30180.
|
||||
error.ProgramFiles = program.getSourceFiles().map(f => f.fileName);
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -967,6 +967,11 @@ namespace ts {
|
||||
readonly called: Identifier;
|
||||
readonly nTypeArguments: number;
|
||||
}
|
||||
|
||||
export interface PossibleProgramFileInfo {
|
||||
ProgramFiles?: string[];
|
||||
}
|
||||
|
||||
// Get info for an expression like `f <` that may be the start of type arguments.
|
||||
export function getPossibleTypeArgumentsInfo(tokenIn: Node, sourceFile: SourceFile): PossibleTypeArgumentInfo | undefined {
|
||||
let token: Node | undefined = tokenIn;
|
||||
|
||||
Reference in new issue
Block a user