diff --git a/types/dompurify/index.d.ts b/types/dompurify/index.d.ts index 188d6e1bed..61e3cf32e2 100644 --- a/types/dompurify/index.d.ts +++ b/types/dompurify/index.d.ts @@ -4,31 +4,33 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface IDOMPurify { - sanitize(s:string):string; - sanitize(s:string, config:IDOMPurifyConfig):any; + sanitize(s: string): string; + sanitize(s: string, config: IDOMPurifyConfig & { RETURN_DOM: true }): HTMLBodyElement; + sanitize(s: string, config: IDOMPurifyConfig & { RETURN_DOM_FRAGMENT: true }): DocumentFragment; + sanitize(s: string, config: IDOMPurifyConfig): T; - addHook(hook:string, cb:(currentNode:Element, data:any, config:IDOMPurifyConfig) => Element):void; + addHook(hook: string, cb: (currentNode: Element, data: any, config: IDOMPurifyConfig) => Element): void; } interface IDOMPurifyConfig { - ADD_ATTR?:string[]; - ADD_TAGS?:string[]; - ALLOW_DATA_ATTR?:boolean; - ALLOWED_ATTR?:string[]; - ALLOWED_TAGS?:string[]; - FORBID_ATTR?:string[]; - FORBID_TAGS?:string[]; - KEEP_CONTENT?:boolean; - RETURN_DOM?:boolean; - RETURN_DOM_FRAGMENT?:boolean; - RETURN_DOM_IMPORT?:boolean; - SAFE_FOR_JQUERY?:boolean; - SANITIZE_DOM?:boolean; - WHOLE_DOCUMENT?:boolean; + ADD_ATTR?: string[]; + ADD_TAGS?: string[]; + ALLOW_DATA_ATTR?: boolean; + ALLOWED_ATTR?: string[]; + ALLOWED_TAGS?: string[]; + FORBID_ATTR?: string[]; + FORBID_TAGS?: string[]; + KEEP_CONTENT?: boolean; + RETURN_DOM?: boolean; + RETURN_DOM_FRAGMENT?: boolean; + RETURN_DOM_IMPORT?: boolean; + SAFE_FOR_JQUERY?: boolean; + SANITIZE_DOM?: boolean; + WHOLE_DOCUMENT?: boolean; } -declare var DOMPurify:IDOMPurify; +declare var DOMPurify: IDOMPurify; declare module 'dompurify' { - export = DOMPurify; + export = DOMPurify; }