From 60f3fe3de23ebeb11cb9bb86bb2b214daeae6b11 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 4 May 2015 11:21:35 -0700 Subject: [PATCH] emit input non .ts files as separate files when 'allowNonTsExtensions' and 'separateCompilation' flags are specified (used in 'transpile' related scenarios) --- src/compiler/utilities.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 3e825c6802c..b750ce9a011 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1435,8 +1435,11 @@ module ts { export function shouldEmitToOwnFile(sourceFile: SourceFile, compilerOptions: CompilerOptions): boolean { if (!isDeclarationFile(sourceFile)) { - if ((isExternalModule(sourceFile) || !compilerOptions.out) && !fileExtensionIs(sourceFile.fileName, ".js")) { - return true; + if ((isExternalModule(sourceFile) || !compilerOptions.out)) { + // 1. in-browser single file compilation scenario + // 2. non .js file + return (compilerOptions.separateCompilation && compilerOptions.allowNonTsExtensions) || + !fileExtensionIs(sourceFile.fileName, ".js"); } return false; }