File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -301,13 +301,13 @@ export function replaceTextareaSelection(textarea: HTMLTextAreaElement, text: st
301301} 
302302
303303// Warning: Do not enter any unsanitized variables here 
304- export  function  createElementFromHTML < T  =  HTMLElement > ( htmlString : string ) : T  { 
304+ export  function  createElementFromHTML < T  extends  HTMLElement > ( htmlString : string ) : T  { 
305305  htmlString  =  htmlString . trim ( ) ; 
306306  // some tags like "tr" are special, it must use a correct parent container to create 
307307  if  ( htmlString . startsWith ( '<tr' ) )  { 
308308    const  container  =  document . createElement ( 'table' ) ; 
309309    container . innerHTML  =  htmlString ; 
310-     return  container . querySelector ( 'tr' )   as   T ; 
310+     return  container . querySelector < T > ( 'tr' ) ; 
311311  } 
312312  const  div  =  document . createElement ( 'div' ) ; 
313313  div . innerHTML  =  htmlString ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments