Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jantimon opened this issue Jan 6, 2023 · 0 comments
Open

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

jantimon opened this issue Jan 6, 2023 · 0 comments

Comments

@jantimon
Copy link

jantimon commented Jan 6, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant