@@ -28,14 +28,14 @@ export interface IDom {
2828 * @param callback The function that receives a notification when an event of the specified type occurs.
2929 * @param capture If true, useCapture indicates that the user wishes to initiate capture.
3030 */
31- addEventListener ( eventName : string , callback : EventListener , capture : boolean ) : void ;
31+ addEventListener ( eventName : string , callback : EventListenerOrEventListenerObject , capture : boolean ) : void ;
3232 /**
3333 * Remove an event listener from the document.
3434 * @param eventName A string representing the event type to listen for.
3535 * @param callback The function to remove from the event.
3636 * @param capture Specifies whether the listener to be removed was registered as a capturing listener or not.
3737 */
38- removeEventListener ( eventName : string , callback : EventListener , capture : boolean ) : void ;
38+ removeEventListener ( eventName : string , callback : EventListenerOrEventListenerObject , capture : boolean ) : void ;
3939 /**
4040 * Adopts a node from an external document.
4141 * @param node The node to be adopted.
@@ -47,7 +47,8 @@ export interface IDom {
4747 * @param tagName A string that specifies the type of element to be created.
4848 * @return The created element.
4949 */
50- createElement ( tagName : string ) : Element ;
50+ createElement < T extends keyof HTMLElementTagNameMap > ( tagName : T ) : HTMLElementTagNameMap [ T ] ;
51+ createElement ( tagName : string ) : HTMLElement ;
5152 /**
5253 * Creates the specified HTML attribute
5354 * @param name A string that specifies the name of attribute to be created.
@@ -102,11 +103,17 @@ export interface IDom {
102103 */
103104 getElementById ( id : string ) : Element ;
104105 /**
106+ * Performs a query selector on the document and returns first matched element, depth first.
107+ * @param query The query to use in searching the document.
108+ * @return A list of all matched elements in the document.
109+ */
110+ querySelector < E extends Element = Element > ( selectors : string ) : E | null ;
111+ /**
105112 * Performs a query selector on the document and returns all located matches.
106113 * @param query The query to use in searching the document.
107114 * @return A list of all matched elements in the document.
108115 */
109- querySelectorAll ( query : string ) : NodeList ;
116+ querySelectorAll < E extends Element = Element > ( selectors : string ) : NodeListOf < E > ;
110117 /**
111118 * Gets the element that is the next sibling of the provided element.
112119 * @param element The element whose next sibling is being located.
@@ -118,7 +125,7 @@ export interface IDom {
118125 * @param markup A string containing the markup to turn into a template. Note: This string must contain the template element as well.
119126 * @return The instance of HTMLTemplateElement that was created from the provided markup.
120127 */
121- createTemplateFromMarkup ( markup : string ) : Element ;
128+ createTemplateFromMarkup ( markup : string ) : HTMLTemplateElement ;
122129 /**
123130 * Appends a node to the parent, if provided, or the document.body otherwise.
124131 * @param newNode The node to append.
0 commit comments