@@ -528,8 +528,9 @@ export default class HTMLElement extends Node {
528528	/** 
529529	 * find element by it's id 
530530	 * @param  {string } id the id of the element to select 
531+ 	 * @returns  {HTMLElement | null } the element with the given id or null if not found 
531532	 */ 
532- 	public  getElementById ( id : string )  { 
533+ 	public  getElementById ( id : string ) :  HTMLElement   |   null  { 
533534		const  stack : Array < number >  =  [ ] ; 
534535
535536		let  currentNodeReference  =  this  as  Node ; 
@@ -572,8 +573,9 @@ export default class HTMLElement extends Node {
572573	/** 
573574	 * traverses the Element and its parents (heading toward the document root) until it finds a node that matches the provided selector string. Will return itself or the matching ancestor. If no such element exists, it returns null. 
574575	 * @param  selector a DOMString containing a selector list 
576+ 	 * @returns  {HTMLElement | null } the element with the given id or null if not found 
575577	 */ 
576- 	public  closest ( selector : string )  { 
578+ 	public  closest ( selector : string ) :  HTMLElement   |   null  { 
577579		type  Predicate  =  ( node : Node )  =>  node  is HTMLElement ; 
578580
579581		const  mapChild  =  new  Map < Node ,  Node > ( ) ; 
@@ -642,17 +644,17 @@ export default class HTMLElement extends Node {
642644
643645	/** 
644646	 * Get first child node 
645- 	 * @return  {Node } first child node 
647+ 	 * @return  {Node | undefined  } first child node; or undefined if none  
646648	 */ 
647- 	public  get  firstChild ( )  { 
649+ 	public  get  firstChild ( ) :  Node   |   undefined  { 
648650		return  this . childNodes [ 0 ] ; 
649651	} 
650652
651653	/** 
652654	 * Get last child node 
653- 	 * @return  {Node } last child node 
655+ 	 * @return  {Node | undefined  } last child node; or undefined if none  
654656	 */ 
655- 	public  get  lastChild ( )  { 
657+ 	public  get  lastChild ( ) :  Node   |   undefined  { 
656658		return  arr_back ( this . childNodes ) ; 
657659	} 
658660
@@ -737,7 +739,7 @@ export default class HTMLElement extends Node {
737739
738740	/** 
739741	 * Get an attribute 
740- 	 * @return  {string } value of the attribute 
742+ 	 * @return  {string | undefined  } value of the attribute; or undefined if not exist  
741743	 */ 
742744	public  getAttribute ( key : string ) : string  |  undefined  { 
743745		return  this . attrs [ key . toLowerCase ( ) ] ; 
@@ -839,7 +841,7 @@ export default class HTMLElement extends Node {
839841		// } 
840842	} 
841843
842- 	public  get  nextSibling ( )  { 
844+ 	public  get  nextSibling ( ) :  Node   |   null  { 
843845		if  ( this . parentNode )  { 
844846			const  children  =  this . parentNode . childNodes ; 
845847			let  i  =  0 ; 
@@ -851,7 +853,7 @@ export default class HTMLElement extends Node {
851853		} 
852854	} 
853855
854- 	public  get  nextElementSibling ( ) : HTMLElement  { 
856+ 	public  get  nextElementSibling ( ) : HTMLElement  |   null   { 
855857		if  ( this . parentNode )  { 
856858			const  children  =  this . parentNode . childNodes ; 
857859			let  i  =  0 ; 
@@ -870,7 +872,7 @@ export default class HTMLElement extends Node {
870872		} 
871873	} 
872874
873- 	public  get  previousSibling ( )  { 
875+ 	public  get  previousSibling ( ) :  Node   |   null  { 
874876		if  ( this . parentNode )  { 
875877			const  children  =  this . parentNode . childNodes ; 
876878			let  i  =  children . length ; 
@@ -882,7 +884,7 @@ export default class HTMLElement extends Node {
882884		} 
883885	} 
884886
885- 	public  get  previousElementSibling ( ) : HTMLElement  { 
887+ 	public  get  previousElementSibling ( ) : HTMLElement  |   null   { 
886888		if  ( this . parentNode )  { 
887889			const  children  =  this . parentNode . childNodes ; 
888890			let  i  =  children . length ; 
0 commit comments