* Visits an export declaration, eliding it if it does not contain a clause that resolves to a value. * * @param node The export declaration node.
(node)
| 93882 | * @param node The export declaration node. |
| 93883 | */ |
| 93884 | function visitExportDeclaration(node) { |
| 93885 | if (node.isTypeOnly) { |
| 93886 | return undefined; |
| 93887 | } |
| 93888 | if (!node.exportClause || ts.isNamespaceExport(node.exportClause)) { |
| 93889 | // never elide `export <whatever> from <whereever>` declarations - |
| 93890 | // they should be kept for sideffects/untyped exports, even when the |
| 93891 | // type checker doesn't know about any exports |
| 93892 | return node; |
| 93893 | } |
| 93894 | // Elide the export declaration if all of its named exports are elided. |
| 93895 | var allowEmpty = !!node.moduleSpecifier && (compilerOptions.importsNotUsedAsValues === 1 /* ImportsNotUsedAsValues.Preserve */ || |
| 93896 | compilerOptions.importsNotUsedAsValues === 2 /* ImportsNotUsedAsValues.Error */); |
| 93897 | var exportClause = ts.visitNode(node.exportClause, function (bindings) { return visitNamedExportBindings(bindings, allowEmpty); }, ts.isNamedExportBindings); |
| 93898 | return exportClause |
| 93899 | ? factory.updateExportDeclaration(node, |
| 93900 | /*decorators*/ undefined, |
| 93901 | /*modifiers*/ undefined, node.isTypeOnly, exportClause, node.moduleSpecifier, node.assertClause) |
| 93902 | : undefined; |
| 93903 | } |
| 93904 | /** |
| 93905 | * Visits named exports, eliding it if it does not contain an export specifier that |
| 93906 | * resolves to a value. |
no test coverage detected