@@ -2777,15 +2777,28 @@ class DocSearch {
27772777 for ( const result of results ) {
27782778 if ( result . id !== - 1 ) {
27792779 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 } */
27802785 const obj = Object . assign ( {
2786+ parent : result . parent ,
2787+ type : result . type ,
27812788 dist : result . dist ,
2789+ path_dist : result . path_dist ,
2790+ index : result . index ,
2791+ desc : result . desc ,
2792+ item : result . item ,
27822793 displayPath : pathSplitter ( res [ 0 ] ) ,
2794+ fullPath : "" ,
2795+ href : "" ,
2796+ displayTypeSignature : null ,
27832797 } , this . searchIndex [ result . id ] ) ;
27842798
27852799 // 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+
27892802 if ( duplicates . has ( obj . fullPath ) ) {
27902803 continue ;
27912804 }
@@ -2798,26 +2811,22 @@ class DocSearch {
27982811 if ( duplicates . has ( res [ 2 ] + "|" + TY_IMPORT ) ) {
27992812 continue ;
28002813 }
2801- // @ts -expect-error
28022814 duplicates . add ( obj . fullPath ) ;
28032815 duplicates . add ( res [ 2 ] ) ;
28042816
28052817 if ( typeInfo !== null ) {
2806- // @ts -expect-error
28072818 obj . displayTypeSignature =
28082819 // @ts -expect-error
28092820 this . formatDisplayTypeSignature ( obj , typeInfo ) ;
28102821 }
28112822
2812- // @ts -expect-error
28132823 obj . href = res [ 1 ] ;
28142824 out . push ( obj ) ;
28152825 if ( out . length >= MAX_RESULTS ) {
28162826 break ;
28172827 }
28182828 }
28192829 }
2820- // @ts -expect-error
28212830 return out ;
28222831 } ;
28232832
@@ -2830,11 +2839,7 @@ class DocSearch {
28302839 *
28312840 * @param {rustdoc.ResultObject } obj
28322841 * @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> }
28382843 */
28392844 this . formatDisplayTypeSignature = async ( obj , typeInfo ) => {
28402845 const objType = obj . type ;
0 commit comments