From faa1999428ba475de700ff952e656a148edfa56a Mon Sep 17 00:00:00 2001 From: icosahebron Date: Sat, 17 Jun 2017 21:33:49 -0700 Subject: [PATCH] Update Delta#transform and Delta#transformPosition --- types/quill/index.d.ts | 4 ++-- types/quill/quill-tests.ts | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/types/quill/index.d.ts b/types/quill/index.d.ts index 650408c67c..73a877815f 100644 --- a/types/quill/index.d.ts +++ b/types/quill/index.d.ts @@ -69,9 +69,9 @@ declare namespace Quill { concat(other: DeltaStatic): DeltaStatic; diff(other: DeltaStatic, index?: number) : DeltaStatic; eachLine(predicate: (line: DeltaStatic, attributes: StringMap, idx: number) => any, newline?: string) : DeltaStatic; - transform(index: number) : DeltaStatic; + transform(index: number) : number; transform(other: DeltaStatic, priority: boolean) : DeltaStatic; - transformPosition(index: number) : DeltaStatic; + transformPosition(index: number) : number; } export interface RangeStatic { diff --git a/types/quill/quill-tests.ts b/types/quill/quill-tests.ts index fe2af00afc..f45781a685 100644 --- a/types/quill/quill-tests.ts +++ b/types/quill/quill-tests.ts @@ -324,13 +324,14 @@ function test_DeltaTransform() { var a = new Delta().insert('a'); var b = new Delta().insert('b').retain(5).insert('c'); - a.transform(b, true); // new Delta().retain(1).insert('b').retain(5).insert('c'); - a.transform(b, false); // new Delta().insert('b').retain(6).insert('c'); - a.transform(5); + var d1: Quill.DeltaStatic = a.transform(b, true); // new Delta().retain(1).insert('b').retain(5).insert('c'); + var d2: Quill.DeltaStatic = a.transform(b, false); // new Delta().insert('b').retain(6).insert('c'); + var n1: number = a.transform(5); + } function test_DeltatransformPosition() { var delta = new Delta().retain(5).insert('a'); - delta.transformPosition(4); // 4 - delta.transformPosition(5); // 6 + var n1: number = delta.transformPosition(4); // 4 + var n2: number = delta.transformPosition(5); // 6 }