@@ -1413,8 +1413,14 @@ impl<'a> DocParser<'a> {
14131413 self . get_doc_for_export_default_decl ( module_info, n)
14141414 }
14151415 SymbolNodeRef :: ExportDefaultExpr ( n) => {
1416- let js_doc = js_doc_for_range ( module_info, n. span ( ) ) ?;
1417- let location = get_location ( module_info, n. span ( ) . start ) ;
1416+ let ( js_doc, location) = self
1417+ . export_default_expr_context ( module_info, n)
1418+ . unwrap_or_else ( || {
1419+ (
1420+ js_doc_for_range ( module_info, n. span ( ) ) . unwrap_or_default ( ) ,
1421+ get_location ( module_info, n. span ( ) . start ) ,
1422+ )
1423+ } ) ;
14181424 self . get_decl_for_export_default_expr ( module_info, n, js_doc, location)
14191425 }
14201426 SymbolNodeRef :: FnDecl ( n) => {
@@ -1530,6 +1536,26 @@ impl<'a> DocParser<'a> {
15301536 }
15311537 }
15321538
1539+ fn export_default_expr_context (
1540+ & self ,
1541+ module_info : & EsModuleInfo ,
1542+ export_expr : & ExportDefaultDeclarationKind ,
1543+ ) -> Option < ( JsDoc , Location ) > {
1544+ let expr_span = export_expr. span ( ) ;
1545+ for stmt in module_info. statements ( ) {
1546+ let Statement :: ExportDefaultDeclaration ( export_default) = stmt else {
1547+ continue ;
1548+ } ;
1549+ if export_default. declaration . span ( ) == expr_span {
1550+ return Some ( (
1551+ js_doc_for_range ( module_info, export_default. span ) ?,
1552+ get_location ( module_info, export_default. span . start ) ,
1553+ ) ) ;
1554+ }
1555+ }
1556+ None
1557+ }
1558+
15331559 fn get_declare_for_export_decl_declaration (
15341560 & self ,
15351561 export_decl : & ExportNamedDeclaration ,
0 commit comments