From 94ca48114444439f8e4bea0cfb451126c62c52a7 Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Tue, 5 Feb 2019 10:44:22 +0100 Subject: [PATCH 1/3] libxmljs: Allow boolean options --- types/libxmljs/index.d.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/types/libxmljs/index.d.ts b/types/libxmljs/index.d.ts index a29a6adeda..db37035f06 100644 --- a/types/libxmljs/index.d.ts +++ b/types/libxmljs/index.d.ts @@ -14,12 +14,15 @@ export const libxml_parser_version: string; // tslint:disable-next-line:strict-export-declare-modifiers interface StringMap { [key: string]: string; } -export function parseXml(source: string, options?: StringMap): Document; -export function parseXmlString(source: string, options?: StringMap): Document; +// tslint:disable-next-line:strict-export-declare-modifiers +interface ParserOptions { [key: string]: boolean | string; } -export function parseHtml(source: string, options?: StringMap): Document; -export function parseHtmlString(source: string, options?: StringMap): Document; -export function parseHtmlFragment(source: string, options?: StringMap): Document; +export function parseXml(source: string, options?: ParserOptions): Document; +export function parseXmlString(source: string, options?: ParserOptions): Document; + +export function parseHtml(source: string, options?: ParserOptions): Document; +export function parseHtmlString(source: string, options?: ParserOptions): Document; +export function parseHtmlFragment(source: string, options?: ParserOptions): Document; export function memoryUsage(): number; export function nodeCount(): number; From 89d2235d1d4d655f3f2a1584f41e7797029c6fc5 Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Wed, 6 Feb 2019 14:32:30 +0100 Subject: [PATCH 2/3] Add addPrevSibling typing --- types/libxmljs/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/libxmljs/index.d.ts b/types/libxmljs/index.d.ts index db37035f06..5ba3fc294f 100644 --- a/types/libxmljs/index.d.ts +++ b/types/libxmljs/index.d.ts @@ -116,6 +116,7 @@ export class Element extends Node { prevElement(): Element|null; nextElement(): Element|null; addNextSibling(siblingNode: Node): Node; + addPrevSibling(siblingNode: Node): Node; find(xpath: string, ns_uri?: string): Node[]; find(xpath: string, namespaces: StringMap): Node[]; From 5d016cee8f01b5307da196a6feca3583ec5a939c Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Wed, 6 Feb 2019 22:18:13 +0100 Subject: [PATCH 3/3] libxmljs: Type all options --- types/libxmljs/index.d.ts | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/types/libxmljs/index.d.ts b/types/libxmljs/index.d.ts index 5ba3fc294f..6540561a07 100644 --- a/types/libxmljs/index.d.ts +++ b/types/libxmljs/index.d.ts @@ -15,7 +15,40 @@ export const libxml_parser_version: string; interface StringMap { [key: string]: string; } // tslint:disable-next-line:strict-export-declare-modifiers -interface ParserOptions { [key: string]: boolean | string; } +interface ParserOptions { + recover?: boolean; + noent?: boolean; + dtdload?: boolean; + doctype?: boolean; + dtdattr?: any; + dtdvalid?: boolean; + noerror?: boolean; + errors?: boolean; + nowarning?: boolean; + warnings?: boolean; + pedantic?: boolean; + noblanks?: boolean; + blanks?: boolean; + sax1?: boolean; + xinclude?: boolean; + nonet?: boolean; + net?: boolean; + nodict?: boolean; + dict?: boolean; + nsclean?: boolean; + implied?: boolean; + nocdata?: boolean; + cdata?: boolean; + noxincnode?: boolean; + compact?: boolean; + old?: boolean; + nobasefix?: boolean; + basefix?: boolean; + huge?: boolean; + oldsax?: boolean; + ignore_enc?: boolean; + big_lines?: boolean; +} export function parseXml(source: string, options?: ParserOptions): Document; export function parseXmlString(source: string, options?: ParserOptions): Document;