Fix throw exception on emit file

Fix issue #852
Can you move this to parser.ts like (isExternalModule) 

Also I would write this as return !!(sourceFile.flags & NodeFlags.DeclarationFile);