Skip to content

Commit 4c714af

Browse files
author
Derek Hammond
committed
fix typescript errors
1 parent e53a882 commit 4c714af

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/compute-lines.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import * as diff from 'diff';
22

3+
const jsDiff: { [key: string]: any } = diff;
4+
35
export enum DiffType {
46
DEFAULT = 0,
57
ADDED = 1,
@@ -17,6 +19,8 @@ export enum DiffMethod {
1719
}
1820

1921
export interface DiffInformation {
22+
added?: boolean;
23+
removed?: boolean;
2024
value?: string | DiffInformation[];
2125
lineNumber?: number;
2226
type?: DiffType;
@@ -77,13 +81,13 @@ const constructLines = (value: string): string[] => {
7781
* @param jsDiffCompareMethod JsDiff text diff method from https://github.com/kpdecker/jsdiff/tree/v4.0.1#api
7882
*/
7983
const computeDiff = (oldValue: string, newValue: string, jsDiffCompareMethod: string): ComputedDiffInformation => {
80-
const diffArray = diff[jsDiffCompareMethod](oldValue, newValue);
84+
const diffArray = jsDiff[jsDiffCompareMethod](oldValue, newValue);
8185
const computedDiff: ComputedDiffInformation = {
8286
left: [],
8387
right: [],
8488
};
8589
diffArray
86-
.forEach(({ added, removed, value }): DiffInformation => {
90+
.forEach(({ added, removed, value }: DiffInformation): DiffInformation => {
8791
const diffInformation: DiffInformation = {};
8892
if (added) {
8993
diffInformation.type = DiffType.ADDED;

0 commit comments

Comments
 (0)