angus-c / angus-c/just

Types of just-diff and just-diff-apply do not match

未關閉
#560 1 則留言 2 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
JavaScript
星號
6.2k
分支
210
PR 合併指標
30 天內沒有已合併 PR

描述

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:
```ts
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)[]'.
```

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。