From 83afa4d4c7baf76dfeff53b69b59666af1e6046d Mon Sep 17 00:00:00 2001 From: Ian Craig Date: Wed, 27 Jun 2018 11:45:05 -0700 Subject: [PATCH] Add HtmlFormatter typings to expose showUnchanged and hideUnchanged --- src/index.d.ts | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index d580f95f..a68ce473 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -1,5 +1,22 @@ export interface Formatter { - format(delta: Delta, original: any): string; + format(delta: Delta, original: any): string; +} + +export interface HtmlFormatter extends Formatter { + /** + * Set whether to show or hide unchanged parts of a diff. + * @param show Whether to show unchanged parts + * @param node The root element the diff is contained within. (Default: body) + * @param delay Transition time in ms. (Default: no transition) + */ + showUnchanged(show: boolean, node?: Element | null, delay?: number): void; + + /** + * An alias for showUnchanged(false, ...) + * @param node The root element the diff is contained within (Default: body) + * @param delay Transition time in ms. (Default: no transition) + */ + hideUnchanged(node?: Element | null, delay?: number): void; } export interface Delta { @@ -52,9 +69,9 @@ export class DiffPatcher { } export const formatters: { - annotated: Formatter; - console: Formatter; - html: Formatter; + annotated: Formatter; + console: Formatter; + html: HtmlFormatter; }; export const console: Formatter