corps/json-delta

TS2322: Type 'null' is not assignable to type 'void | Diff'

jantimon opened this issue · 0 comments

the diff function return type is Diff | void however it returns null in line 152:

json-delta/index.ts

Lines 144 to 154 in 41275a6

export function diff(
a: AnyJson,
b: AnyJson,
tolerance = Infinity
): Diff | void {
let result: Diff = [];
if (gatherDiff(a, b, tolerance, [], result) || result.length > tolerance)
return [[[], b]];
if (result.length === 0) return null;
return result;
}

I can prepare a PR if it helps