From 791a0e4e391636b427ebb4bbc31f3512950ebadd Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 19 Mar 2015 21:12:25 -0700 Subject: [PATCH] Don't actually emit declarations when we just want the diagnostics for them. --- src/compiler/program.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 73e50ca096b..a4c3a65f29c 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -254,7 +254,9 @@ module ts { function getDeclarationDiagnosticsForFile(sourceFile: SourceFile): Diagnostic[] { if (!isDeclarationFile(sourceFile)) { let resolver = getDiagnosticsProducingTypeChecker().getEmitResolver(sourceFile); - return ts.getDeclarationDiagnostics(getEmitHost(), resolver, sourceFile); + // Don't actually write any files since we're just getting diagnostics. + var writeFile: WriteFileCallback = () => { }; + return ts.getDeclarationDiagnostics(getEmitHost(writeFile), resolver, sourceFile); } }