Skip to content

Commit 71b595a

Browse files
authored
fix: add types for stablePatchmarks (#74)
* fix: add types for stablePatchmarks * fix flow
1 parent 0daad5a commit 71b595a

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ type DiffOptions = {
44
expand?: boolean
55
colors?: boolean
66
contextLines?: number
7+
stablePatchmarks?: boolean
78
aAnnotation?: string
89
bAnnotation?: string
910
}

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ const prettyFormat = require('pretty-format');
99
const { ReactElement } = prettyFormat.plugins;
1010
const reactElement = Symbol.for('react.element');
1111

12-
type Options = {
12+
type Options = {|
1313
expand?: boolean,
1414
colors?: boolean,
1515
contextLines?: number,
16+
stablePatchmarks?: boolean,
1617
aAnnotation?: string,
1718
bAnnotation?: string,
18-
};
19+
|};
1920

2021
const defaultOptions = {
2122
expand: false,
@@ -30,7 +31,7 @@ const SNAPSHOT_TITLE = 'Snapshot Diff:\n';
3031

3132
const snapshotDiff = (valueA: any, valueB: any, options?: Options): string => {
3233
let difference;
33-
const mergedOptions = Object.assign({}, defaultOptions, options);
34+
const mergedOptions = { ...defaultOptions, ...options };
3435

3536
if (isReactComponent(valueA) && isReactComponent(valueB)) {
3637
difference = diffReactComponents(valueA, valueB, mergedOptions);

0 commit comments

Comments
 (0)