importedLocals
The names an import declaration binds.
import { isNamedImports, isNamespaceImport as ts_isNamespaceImport } from "typescript/ast"; import type { ImportDeclaration } from "typescript/ast"; export function importedLocals(st: ImportDeclaration): string[] { const c = st.importClause; if (!c) return []; const b = c.namedBindings; return [...(c.name ? [c.name.text] : []), ...(b && ts_isNamespaceImport(b) ? [b.name.text] : b && isNamedImports(b) ? b.elements.map((e) => e.name.text) : [])]; }