3535 * import { A, B } from "./b";
3636 * export { A } from "./b";
3737 */
38- import { ImportOrExportDeclaration , VisitorContext } from "../types" ;
3938import {
4039 Debug ,
41- EmitResolver ,
42- ExportSpecifier ,
43- ImportClause ,
4440 ImportsNotUsedAsValues ,
45- ImportSpecifier ,
4641 isInJSFile ,
47- NamedExportBindings ,
48- NamedExports ,
49- NamedImportBindings ,
50- NamespaceExport ,
51- Node ,
52- StringLiteral ,
53- Visitor ,
54- VisitResult ,
42+ type EmitResolver ,
43+ type ExportSpecifier ,
44+ type ImportClause ,
45+ type ImportSpecifier ,
46+ type NamedExportBindings ,
47+ type NamedExports ,
48+ type NamedImportBindings ,
49+ type NamespaceExport ,
50+ type Node ,
51+ type StringLiteral ,
52+ type Visitor ,
53+ type VisitResult ,
5554} from "typescript" ;
5655
56+ import type { ImportOrExportDeclaration , VisitorContext } from "../types.ts" ;
57+
5758/* ****************************************************************************************************************** */
5859// region: Utilities
5960/* ****************************************************************************************************************** */
@@ -104,7 +105,7 @@ export function elideImportOrExportDeclaration(
104105 // Always elide type-only imports
105106 if ( node . importClause . isTypeOnly ) return undefined ;
106107
107- const importClause = visitNode ( node . importClause , < Visitor > visitImportClause ) ;
108+ const importClause = visitNode ( node . importClause , visitImportClause as Visitor ) ;
108109
109110 if (
110111 importClause ||
@@ -139,7 +140,7 @@ export function elideImportOrExportDeclaration(
139140
140141 const exportClause = visitNode (
141142 node . exportClause ,
142- < Visitor > ( ( bindings : NamedExportBindings ) => visitNamedExportBindings ( bindings , allowEmpty ) ) ,
143+ ( ( bindings : NamedExportBindings ) => visitNamedExportBindings ( bindings , allowEmpty ) ) as Visitor ,
143144 isNamedExportBindings ,
144145 ) ;
145146
@@ -171,7 +172,7 @@ export function elideImportOrExportDeclaration(
171172 function visitImportClause ( node : ImportClause ) : VisitResult < ImportClause > {
172173 // Elide the import clause if we elide both its name and its named bindings.
173174 const name = shouldEmitAliasDeclaration ( node ) ? node . name : undefined ;
174- const namedBindings = visitNode ( node . namedBindings , < Visitor > visitNamedImportBindings , isNamedImportBindings ) ;
175+ const namedBindings = visitNode ( node . namedBindings , visitNamedImportBindings as Visitor , isNamedImportBindings ) ;
175176 return name || namedBindings
176177 ? factory . updateImportClause ( node , /*isTypeOnly*/ false , name , namedBindings )
177178 : undefined ;
@@ -194,7 +195,7 @@ export function elideImportOrExportDeclaration(
194195 ( compilerOptions . importsNotUsedAsValues === ImportsNotUsedAsValues . Preserve ||
195196 compilerOptions . importsNotUsedAsValues === ImportsNotUsedAsValues . Error ) ) ;
196197
197- const elements = visitNodes ( node . elements , < Visitor > visitImportSpecifier , isImportSpecifier ) ;
198+ const elements = visitNodes ( node . elements , visitImportSpecifier as Visitor , isImportSpecifier ) ;
198199 return allowEmpty || tsInstance . some ( elements ) ? factory . updateNamedImports ( node , elements ) : undefined ;
199200 }
200201 }
@@ -212,7 +213,7 @@ export function elideImportOrExportDeclaration(
212213 /** Visits named exports, eliding it if it does not contain an export specifier that resolves to a value. */
213214 function visitNamedExports ( node : NamedExports , allowEmpty : boolean ) : VisitResult < NamedExports > | undefined {
214215 // Elide the named exports if all of its export specifiers were elided.
215- const elements = visitNodes ( node . elements , < Visitor > visitExportSpecifier , isExportSpecifier ) ;
216+ const elements = visitNodes ( node . elements , visitExportSpecifier as Visitor , isExportSpecifier ) ;
216217 return allowEmpty || tsInstance . some ( elements ) ? factory . updateNamedExports ( node , elements ) : undefined ;
217218 }
218219
0 commit comments