@@ -2777,15 +2777,28 @@ class DocSearch {
2777
2777
for ( const result of results ) {
2778
2778
if ( result . id !== - 1 ) {
2779
2779
const res = buildHrefAndPath ( this . searchIndex [ result . id ] ) ;
2780
+ // many of these properties don't strictly need to be
2781
+ // copied over, but copying them over satisfies tsc,
2782
+ // and hopefully plays nice with the shape optimization
2783
+ // of the browser engine.
2784
+ /** @type {rustdoc.ResultObject } */
2780
2785
const obj = Object . assign ( {
2786
+ parent : result . parent ,
2787
+ type : result . type ,
2781
2788
dist : result . dist ,
2789
+ path_dist : result . path_dist ,
2790
+ index : result . index ,
2791
+ desc : result . desc ,
2792
+ item : result . item ,
2782
2793
displayPath : pathSplitter ( res [ 0 ] ) ,
2794
+ fullPath : "" ,
2795
+ href : "" ,
2796
+ displayTypeSignature : null ,
2783
2797
} , this . searchIndex [ result . id ] ) ;
2784
2798
2785
2799
// To be sure than it some items aren't considered as duplicate.
2786
- // @ts -expect-error
2787
- obj . fullPath = res [ 2 ] + "|" + obj . ty ;
2788
- // @ts -expect-error
2800
+ obj . fullPath = res [ 2 ] + "|" + obj . ty
2801
+
2789
2802
if ( duplicates . has ( obj . fullPath ) ) {
2790
2803
continue ;
2791
2804
}
@@ -2798,26 +2811,22 @@ class DocSearch {
2798
2811
if ( duplicates . has ( res [ 2 ] + "|" + TY_IMPORT ) ) {
2799
2812
continue ;
2800
2813
}
2801
- // @ts -expect-error
2802
2814
duplicates . add ( obj . fullPath ) ;
2803
2815
duplicates . add ( res [ 2 ] ) ;
2804
2816
2805
2817
if ( typeInfo !== null ) {
2806
- // @ts -expect-error
2807
2818
obj . displayTypeSignature =
2808
2819
// @ts -expect-error
2809
2820
this . formatDisplayTypeSignature ( obj , typeInfo ) ;
2810
2821
}
2811
2822
2812
- // @ts -expect-error
2813
2823
obj . href = res [ 1 ] ;
2814
2824
out . push ( obj ) ;
2815
2825
if ( out . length >= MAX_RESULTS ) {
2816
2826
break ;
2817
2827
}
2818
2828
}
2819
2829
}
2820
- // @ts -expect-error
2821
2830
return out ;
2822
2831
} ;
2823
2832
@@ -2830,11 +2839,7 @@ class DocSearch {
2830
2839
*
2831
2840
* @param {rustdoc.ResultObject } obj
2832
2841
* @param {"sig"|"elems"|"returned"|null } typeInfo
2833
- * @returns {Promise<{
2834
- * "type": Array<string>,
2835
- * "mappedNames": Map<string, string>,
2836
- * "whereClause": Map<string, Array<string>>,
2837
- * }>}
2842
+ * @returns {Promise<rustdoc.DisplayTypeSignature> }
2838
2843
*/
2839
2844
this . formatDisplayTypeSignature = async ( obj , typeInfo ) => {
2840
2845
const objType = obj . type ;
0 commit comments