(isValidTypeOnlyUseSite, isForNewImportDeclaration, symbol, targetFlags, checker, compilerOptions)
| 153252 | } |
| 153253 | } |
| 153254 | function getAddAsTypeOnly(isValidTypeOnlyUseSite, isForNewImportDeclaration, symbol, targetFlags, checker, compilerOptions) { |
| 153255 | if (!isValidTypeOnlyUseSite) { |
| 153256 | // Can't use a type-only import if the usage is an emitting position |
| 153257 | return 4 /* AddAsTypeOnly.NotAllowed */; |
| 153258 | } |
| 153259 | if (isForNewImportDeclaration && compilerOptions.importsNotUsedAsValues === 2 /* ImportsNotUsedAsValues.Error */) { |
| 153260 | // Not writing a (top-level) type-only import here would create an error because the runtime dependency is unnecessary |
| 153261 | return 2 /* AddAsTypeOnly.Required */; |
| 153262 | } |
| 153263 | if (compilerOptions.isolatedModules && compilerOptions.preserveValueImports && |
| 153264 | (!(targetFlags & 111551 /* SymbolFlags.Value */) || !!checker.getTypeOnlyAliasDeclaration(symbol))) { |
| 153265 | // A type-only import is required for this symbol if under these settings if the symbol will |
| 153266 | // be erased, which will happen if the target symbol is purely a type or if it was exported/imported |
| 153267 | // as type-only already somewhere between this import and the target. |
| 153268 | return 2 /* AddAsTypeOnly.Required */; |
| 153269 | } |
| 153270 | return 1 /* AddAsTypeOnly.Allowed */; |
| 153271 | } |
| 153272 | function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) { |
| 153273 | return ts.firstDefined(existingImports, function (_a) { |
| 153274 | var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags; |
no outgoing calls
no test coverage detected