Skip to content

Commit f90595d

Browse files
committed
The added and removed properties of change objects are now guaranteed to be set to a boolean value
kpdecker/jsdiff#455
1 parent b68bc22 commit f90595d

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

types/diff/diff-tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ examineChanges(changes);
7373

7474
function examineChanges(diff: Diff.Change[]) {
7575
diff.forEach(part => {
76-
part.added; // $ExpectType boolean | undefined
77-
part.removed; // $ExpectType boolean | undefined
76+
part.added; // $ExpectType boolean
77+
part.removed; // $ExpectType boolean
7878
part.value; // $ExpectType string
7979
part.count; // $ExpectType number | undefined
8080
});

types/diff/index.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ export interface Change {
109109
*/
110110
value: string;
111111
/**
112-
* `true` if the value was inserted into the new string.
112+
* true if the value was inserted into the new string, otherwise false
113113
*/
114-
added?: boolean | undefined;
114+
added: boolean;
115115
/**
116-
* `true` if the value was removed from the old string.
116+
* true if the value was removed from the old string, otherwise false
117117
*/
118-
removed?: boolean | undefined;
118+
removed: boolean;
119119
}
120120

121121
export interface ArrayChange<T> {

0 commit comments

Comments
 (0)