diff --git a/src/compiler/core.ts b/src/compiler/core.ts
index 872f5797b36..3befc988a18 100644
--- a/src/compiler/core.ts
+++ b/src/compiler/core.ts
@@ -942,7 +942,7 @@ namespace ts {
* [^./] # matches everything up to the first . character (excluding directory seperators)
* (\\.(?!min\\.js$))? # matches . characters but not if they are part of the .min.js file extension
*/
- const singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*";
+ const singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*";
const singleAsteriskRegexFragmentOther = "[^/]*";
export function getRegularExpressionForWildcard(specs: string[], basePath: string, usage: "files" | "directories" | "exclude") {
@@ -1196,6 +1196,14 @@ namespace ts {
return options && options.allowJs ? allSupportedExtensions : supportedTypeScriptExtensions;
}
+ export function hasJavaScriptFileExtension(fileName: string) {
+ return forEach(supportedJavascriptExtensions, extension => fileExtensionIs(fileName, extension));
+ }
+
+ export function hasTypeScriptFileExtension(fileName: string) {
+ return forEach(supportedTypeScriptExtensions, extension => fileExtensionIs(fileName, extension));
+ }
+
export function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions) {
if (!fileName) { return false; }
diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts
index 4ae0005e9c5..c73cf37fdda 100644
--- a/src/compiler/utilities.ts
+++ b/src/compiler/utilities.ts
@@ -2718,14 +2718,6 @@ namespace ts {
return symbol && symbol.valueDeclaration && (symbol.valueDeclaration.flags & NodeFlags.Default) ? symbol.valueDeclaration.localSymbol : undefined;
}
- export function hasJavaScriptFileExtension(fileName: string) {
- return forEach(supportedJavascriptExtensions, extension => fileExtensionIs(fileName, extension));
- }
-
- export function hasTypeScriptFileExtension(fileName: string) {
- return forEach(supportedTypeScriptExtensions, extension => fileExtensionIs(fileName, extension));
- }
-
/**
* Replace each instance of non-ascii characters by one, two, three, or four escape sequences
* representing the UTF-8 encoding of the character, and return the expanded char code list.
diff --git a/src/server/typingsInstaller/typingsInstaller.ts b/src/server/typingsInstaller/typingsInstaller.ts
index 7f2615b338e..aadb5241dde 100644
--- a/src/server/typingsInstaller/typingsInstaller.ts
+++ b/src/server/typingsInstaller/typingsInstaller.ts
@@ -1,5 +1,4 @@
///
-///
///
namespace ts.server.typingsInstaller {
diff --git a/src/services/jsTyping.ts b/src/services/jsTyping.ts
index 3b013a4a924..e87f361ca9b 100644
--- a/src/services/jsTyping.ts
+++ b/src/services/jsTyping.ts
@@ -1,7 +1,9 @@
// Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0.
// See LICENSE.txt in the project root for complete license information.
-///
+///
+///
+///
/* @internal */
namespace ts.JsTyping {
@@ -54,7 +56,10 @@ namespace ts.JsTyping {
}
// Only infer typings for .js and .jsx files
- fileNames = filter(map(fileNames, normalizePath), f => scriptKindIs(f, /*LanguageServiceHost*/ undefined, ScriptKind.JS, ScriptKind.JSX));
+ fileNames = filter(map(fileNames, normalizePath), f => {
+ const kind = ensureScriptKind(f, getScriptKindFromFileName(f));
+ return kind === ScriptKind.JS || kind === ScriptKind.JSX;
+ });
if (!safeList) {
const result = readConfigFile(safeListPath, (path: string) => host.readFile(path));
@@ -170,7 +175,7 @@ namespace ts.JsTyping {
mergeTypings(filter(cleanedTypingNames, f => hasProperty(safeList, f)));
}
- const hasJsxFile = forEach(fileNames, f => scriptKindIs(f, /*LanguageServiceHost*/ undefined, ScriptKind.JSX));
+ const hasJsxFile = forEach(fileNames, f => ensureScriptKind(f, getScriptKindFromFileName(f)) === ScriptKind.JSX);
if (hasJsxFile) {
mergeTypings(["react"]);
}