just
just copied to clipboard
Types of just-diff and just-diff-apply do not match
If I use the diff function from just-diff with the jsonPatchPathConverter function provided there, and then use diffApply from just-diff-apply on the result with its jsonPathPathConverter, I receive a TypeError on path.
Minimal example:
const obj1 = {};
const obj2 = {};
const diffObj = diff(obj1, obj2, jsonPatchPathConverter);
diffApply(obj1, diffObj, jsonPatchPathConverter);
With this code, I receive the following error in TypeScript 5.0.4:
Type '{ op: Operation; path: string; value: any; }[]' is not assignable to type 'DiffOps'.
Type '{ op: Operation; path: string; value: any; }' is not assignable to type '{ op: Operation; path: (string | number)[]; value?: any; }'.
Types of property 'path' are incompatible.
Type 'string' is not assignable to type '(string | number)[]'.
I also came here to report this bug. Seems like the types are spec'd differently for jsonPatchPathConverter between just-diff and just-diff-apply.