Skip to content

Commit

Permalink
The added and removed properties of change objects are now guaran…
Browse files Browse the repository at this point in the history
…teed to be set to a boolean value

kpdecker/jsdiff#455
  • Loading branch information
ryota-ka committed Oct 1, 2024
1 parent 8a86ad1 commit 56f68c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions types/diff/diff-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ examineChanges(changes);

function examineChanges(diff: Diff.Change[]) {
diff.forEach(part => {
part.added; // $ExpectType boolean | undefined
part.removed; // $ExpectType boolean | undefined
part.added; // $ExpectType boolean
part.removed; // $ExpectType boolean
part.value; // $ExpectType string
part.count; // $ExpectType number | undefined
});
Expand Down
8 changes: 4 additions & 4 deletions types/diff/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,13 @@ export interface Change {
*/
value: string;
/**
* `true` if the value was inserted into the new string.
* true if the value was inserted into the new string, otherwise false
*/
added?: boolean | undefined;
added: boolean;
/**
* `true` if the value was removed from the old string.
* true if the value was removed from the old string, otherwise false
*/
removed?: boolean | undefined;
removed: boolean;
}

export interface ArrayChange<T> {
Expand Down

0 comments on commit 56f68c7

Please sign in to comment.