From 3b995c66f4276281c489558cec4f0519b2ea2d76 Mon Sep 17 00:00:00 2001 From: lucideer Date: Thu, 27 Oct 2016 21:42:46 +0100 Subject: [PATCH] Union types for possibly undefined return values See https://github.com/libxmljs/libxmljs/wiki --- libxmljs/index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libxmljs/index.d.ts b/libxmljs/index.d.ts index bc33a4eec1..c928f57362 100644 --- a/libxmljs/index.d.ts +++ b/libxmljs/index.d.ts @@ -17,13 +17,13 @@ export declare function parseHtmlString(source: string): HTMLDocument; export declare class XMLDocument { constructor(version: number, encoding: string); - child(idx: number): Element; + child(idx: number): Element | undefined; childNodes(): Element[]; errors(): SyntaxError[]; encoding(): string; encoding(enc: string): void; find(xpath: string): Element[]; - get(xpath: string): Element; + get(xpath: string): Element | undefined; node(name: string, content: string): Element; root(): Element; toString(): string; @@ -48,7 +48,7 @@ export declare class Element { attrs(): Attribute[]; parent(): Element; doc(): XMLDocument; - child(idx: number): Element; + child(idx: number): Element | undefined; childNodes(): Element[]; addChild(child: Element): Element; nextSibling(): Element; @@ -60,9 +60,9 @@ export declare class Element { find(xpath: string): Element[]; find(xpath: string, ns_uri: string): Element[]; find(xpath: string, namespaces: { [key: string]: string; }): Element[]; - get(xpath: string): Element; - get(xpath: string, ns_uri: string): Element; - get(xpath: string, ns_uri: { [key: string]: string; }): Element; + get(xpath: string): Element | undefined; + get(xpath: string, ns_uri: string): Element | undefined; + get(xpath: string, ns_uri: { [key: string]: string; }): Element | undefined; defineNamespace(href: string): Namespace; defineNamespace(prefix: string, href: string): Namespace; namespace(): Namespace;