@@ -12,6 +12,7 @@ use crate::html::types::type_params_summary;
1212use crate :: html:: util:: * ;
1313use crate :: js_doc:: JsDocTag ;
1414use crate :: params:: ParamPatternDef ;
15+ use crate :: ts_type:: TsTypeDef ;
1516use indexmap:: IndexSet ;
1617use serde:: Deserialize ;
1718use serde:: Serialize ;
@@ -419,20 +420,20 @@ fn render_single_function(
419420 . tags
420421 . iter ( )
421422 . filter_map ( |tag| {
422- if let JsDocTag :: Throws { type_ref , doc } = tag
423- && ( type_ref . is_some ( ) || doc. is_some ( ) )
423+ if let JsDocTag :: Throws { ts_type , doc, .. } = tag
424+ && ( ts_type . is_some ( ) || doc. is_some ( ) )
424425 {
425- return Some ( ( type_ref , doc) ) ;
426+ return Some ( ( ts_type , doc) ) ;
426427 }
427428
428429 None
429430 } )
430431 . enumerate ( )
431- . map ( |( i, ( type_ref , doc) ) | {
432+ . map ( |( i, ( ts_type , doc) ) | {
432433 render_function_throws (
433434 ctx,
434435 decl,
435- type_ref ,
436+ ts_type ,
436437 doc,
437438 overload_id. clone ( ) ,
438439 i,
@@ -444,8 +445,8 @@ fn render_single_function(
444445 // Inject removed throws entries
445446 if let Some ( td) = & throws_tags_diff {
446447 for removed_tag in & td. removed {
447- if let JsDocTag :: Throws { type_ref , doc } = removed_tag
448- && ( type_ref . is_some ( ) || doc. is_some ( ) )
448+ if let JsDocTag :: Throws { ts_type , doc, .. } = removed_tag
449+ && ( ts_type . is_some ( ) || doc. is_some ( ) )
449450 {
450451 let id = IdBuilder :: new_with_parent ( ctx, & overload_id)
451452 . kind ( IdKind :: Throws )
@@ -457,7 +458,10 @@ fn render_single_function(
457458 id,
458459 None ,
459460 None ,
460- type_ref. as_ref ( ) . map ( |t| t. as_ref ( ) ) . unwrap_or_default ( ) ,
461+ ts_type
462+ . as_ref ( )
463+ . map ( |t| t. repr . as_str ( ) )
464+ . unwrap_or_default ( ) ,
461465 IndexSet :: new ( ) ,
462466 doc. as_ref ( ) . map ( |d| d. as_ref ( ) ) ,
463467 & decl. location ,
@@ -660,38 +664,37 @@ fn inject_removed_params(
660664fn render_function_throws (
661665 render_ctx : & RenderContext ,
662666 decl : & Declaration ,
663- type_ref : & Option < Box < str > > ,
667+ ts_type : & Option < TsTypeDef > ,
664668 doc : & Option < Box < str > > ,
665669 overload_id : Id ,
666670 throws_id : usize ,
667671 diff : & Option < crate :: diff:: TagsDiff > ,
668672) -> DocEntryCtx {
669- let ( diff_status, old_content) = if let Some ( td) = diff {
670- if let Some ( tag_diff) = td. modified . iter ( ) . find ( |m| {
671- matches ! ( & m. new, JsDocTag :: Throws { type_ref: t, .. } if t == type_ref)
673+ let ( diff_status, old_content) =
674+ if let Some ( td) = diff {
675+ if let Some ( tag_diff) = td. modified . iter ( ) . find ( |m| {
676+ matches ! ( & m. new, JsDocTag :: Throws { ts_type: t, .. } if t == ts_type)
672677 } ) {
673678 let old = if let JsDocTag :: Throws {
674- type_ref : old_type_ref ,
679+ ts_type : old_ts_type ,
675680 ..
676681 } = & tag_diff. old
677682 {
678- old_type_ref
679- . as_ref ( )
680- . map ( |t| t. to_string ( ) )
683+ old_ts_type. as_ref ( ) . map ( |t| t. repr . clone ( ) )
681684 } else {
682685 None
683686 } ;
684687 ( Some ( DiffStatus :: Modified ) , old)
685688 } else if td. added . iter ( ) . any ( |a| {
686- matches ! ( a, JsDocTag :: Throws { type_ref : t, .. } if t == type_ref )
689+ matches ! ( a, JsDocTag :: Throws { ts_type : t, .. } if t == ts_type )
687690 } ) {
688691 ( Some ( DiffStatus :: Added ) , None )
689692 } else {
690693 ( None , None )
691694 }
692- } else {
693- ( None , None )
694- } ;
695+ } else {
696+ ( None , None )
697+ } ;
695698
696699 let id = IdBuilder :: new_with_parent ( render_ctx, & overload_id)
697700 . kind ( IdKind :: Throws )
@@ -703,9 +706,9 @@ fn render_function_throws(
703706 id,
704707 None ,
705708 None ,
706- type_ref
709+ ts_type
707710 . as_ref ( )
708- . map ( |doc| doc . as_ref ( ) )
711+ . map ( |t| t . repr . as_str ( ) )
709712 . unwrap_or_default ( ) ,
710713 IndexSet :: new ( ) ,
711714 doc. as_ref ( ) . map ( |doc| doc. as_ref ( ) ) ,
0 commit comments