From afd6de9c7056ee5670c0a4255e1fc76e3c327106 Mon Sep 17 00:00:00 2001 From: falsandtru Date: Mon, 27 Mar 2017 11:31:32 +0900 Subject: [PATCH] Improve method signatures returning Node type --- baselines/dom.generated.d.ts | 10 +++++----- inputfiles/overridingTypes.json | 30 +++++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 95fad6275..dbf07a9e9 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -3208,7 +3208,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Gets or sets the version attribute specified in the declaration of an XML document. */ xmlVersion: string | null; - adoptNode(source: Node): Node; + adoptNode(source: T): T; captureEvents(): void; caretRangeFromPoint(x: number, y: number): Range; clear(): void; @@ -3385,7 +3385,7 @@ interface Document extends Node, GlobalEventHandlers, NodeSelector, DocumentEven * Gets a value indicating whether the object currently has focus. */ hasFocus(): boolean; - importNode(importedNode: Node, deep: boolean): Node; + importNode(importedNode: T, deep: boolean): T; msElementsFromPoint(x: number, y: number): NodeListOf; msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; /** @@ -8254,15 +8254,15 @@ interface Node extends EventTarget { contains(child: Node): boolean; hasAttributes(): boolean; hasChildNodes(): boolean; - insertBefore(newChild: Node, refChild: Node | null): Node; + insertBefore(newChild: T, refChild: Node | null): T; isDefaultNamespace(namespaceURI: string | null): boolean; isEqualNode(arg: Node): boolean; isSameNode(other: Node): boolean; lookupNamespaceURI(prefix: string | null): string | null; lookupPrefix(namespaceURI: string | null): string | null; normalize(): void; - removeChild(oldChild: Node): Node; - replaceChild(newChild: Node, oldChild: Node): Node; + removeChild(oldChild: T): T; + replaceChild(newChild: Node, oldChild: T): T; readonly ATTRIBUTE_NODE: number; readonly CDATA_SECTION_NODE: number; readonly COMMENT_NODE: number; diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index cb84c43a2..855cdc909 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -12,9 +12,15 @@ }, { "kind": "method", - "interface": "Node", - "name": "insertBefore", - "signatures": ["insertBefore(newChild: Node, refChild: Node | null): Node"] + "interface": "Document", + "name": "adoptNode", + "signatures": ["adoptNode(source: T): T"] + }, + { + "kind": "method", + "interface": "Document", + "name": "importNode", + "signatures": ["importNode(importedNode: T, deep: boolean): T"] }, { "kind": "method", @@ -22,6 +28,24 @@ "name": "appendChild", "signatures": ["appendChild(newChild: T): T"] }, + { + "kind": "method", + "interface": "Node", + "name": "insertBefore", + "signatures": ["insertBefore(newChild: T, refChild: Node | null): T"] + }, + { + "kind": "method", + "interface": "Node", + "name": "removeChild", + "signatures": ["removeChild(oldChild: T): T"] + }, + { + "kind": "method", + "interface": "Node", + "name": "replaceChild", + "signatures": ["replaceChild(newChild: Node, oldChild: T): T"] + }, { "kind": "method", "interface": "HTMLCollection",