(exportInfos, useNamespaceInfo,
/** undefined only for missing JSX namespace */
isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap, fromCacheOnly)
| 153178 | } |
| 153179 | } |
| 153180 | function getImportFixes(exportInfos, useNamespaceInfo, |
| 153181 | /** undefined only for missing JSX namespace */ |
| 153182 | isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap, fromCacheOnly) { |
| 153183 | if (importMap === void 0) { importMap = createExistingImportMap(program.getTypeChecker(), sourceFile, program.getCompilerOptions()); } |
| 153184 | var checker = program.getTypeChecker(); |
| 153185 | var existingImports = ts.flatMap(exportInfos, importMap.getImportsForExportInfo); |
| 153186 | var useNamespace = useNamespaceInfo && tryUseExistingNamespaceImport(existingImports, useNamespaceInfo.symbolName, useNamespaceInfo.position, checker); |
| 153187 | var addToExisting = tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, program.getCompilerOptions()); |
| 153188 | if (addToExisting) { |
| 153189 | // Don't bother providing an action to add a new import if we can add to an existing one. |
| 153190 | return { |
| 153191 | computedWithoutCacheCount: 0, |
| 153192 | fixes: __spreadArray(__spreadArray([], (useNamespace ? [useNamespace] : ts.emptyArray), true), [addToExisting], false), |
| 153193 | }; |
| 153194 | } |
| 153195 | var _a = getFixesForAddImport(exportInfos, existingImports, program, sourceFile, useNamespaceInfo === null || useNamespaceInfo === void 0 ? void 0 : useNamespaceInfo.position, isValidTypeOnlyUseSite, useRequire, host, preferences, fromCacheOnly), fixes = _a.fixes, _b = _a.computedWithoutCacheCount, computedWithoutCacheCount = _b === void 0 ? 0 : _b; |
| 153196 | return { |
| 153197 | computedWithoutCacheCount: computedWithoutCacheCount, |
| 153198 | fixes: __spreadArray(__spreadArray([], (useNamespace ? [useNamespace] : ts.emptyArray), true), fixes, true), |
| 153199 | }; |
| 153200 | } |
| 153201 | function tryUseExistingNamespaceImport(existingImports, symbolName, position, checker) { |
| 153202 | // It is possible that multiple import statements with the same specifier exist in the file. |
| 153203 | // e.g. |
no test coverage detected