|
1 | 1 | // Copyright (c) Microsoft. All rights reserved. Licensed under the Apache License, Version 2.0. |
2 | 2 | // See LICENSE.txt in the project root for complete license information. |
3 | 3 |
|
4 | | -/// <reference path='services.ts' /> |
| 4 | +/// <reference path='../compiler/types.ts' /> |
| 5 | +/// <reference path='../compiler/core.ts' /> |
| 6 | +/// <reference path='../compiler/commandLineParser.ts' /> |
5 | 7 |
|
6 | 8 | /* @internal */ |
7 | 9 | namespace ts.JsTyping { |
@@ -54,7 +56,10 @@ namespace ts.JsTyping { |
54 | 56 | } |
55 | 57 |
|
56 | 58 | // Only infer typings for .js and .jsx files |
57 | | - fileNames = filter(map(fileNames, normalizePath), f => scriptKindIs(f, /*LanguageServiceHost*/ undefined, ScriptKind.JS, ScriptKind.JSX)); |
| 59 | + fileNames = filter(map(fileNames, normalizePath), f => { |
| 60 | + const kind = ensureScriptKind(f, getScriptKindFromFileName(f)); |
| 61 | + return kind === ScriptKind.JS || kind === ScriptKind.JSX; |
| 62 | + }); |
58 | 63 |
|
59 | 64 | if (!safeList) { |
60 | 65 | const result = readConfigFile(safeListPath, (path: string) => host.readFile(path)); |
@@ -170,7 +175,7 @@ namespace ts.JsTyping { |
170 | 175 | mergeTypings(filter(cleanedTypingNames, f => hasProperty(safeList, f))); |
171 | 176 | } |
172 | 177 |
|
173 | | - const hasJsxFile = forEach(fileNames, f => scriptKindIs(f, /*LanguageServiceHost*/ undefined, ScriptKind.JSX)); |
| 178 | + const hasJsxFile = forEach(fileNames, f => ensureScriptKind(f, getScriptKindFromFileName(f)) === ScriptKind.JSX); |
174 | 179 | if (hasJsxFile) { |
175 | 180 | mergeTypings(["react"]); |
176 | 181 | } |
|
0 commit comments