feat(types): add JSONPatchFormatter#316
Conversation
narrow down Operation type
|
@benjamine what do you think? are we good? |
|
Any updates here? :) |
|
BUMP - any updates on this? |
|
@sghoweri we eventually created a fork with more typescript support: https://github.com/contentful/jsondiffpatch I also started an independent project to create patches: |
|
@marcolink oh my gosh you're a lifesaver (was just dealing with the Typescript typing issues with this package) 🙏🏼 |
Oh snap. This is precisely why we started digging into this library to begin with (array diffing combined with JSON patches). 👀 |
Methuselah96
left a comment
There was a problem hiding this comment.
Apologies for the delay review. Don't feel you need to update this PR, we plan on converting the codebase to TypeScript soon anyway, so these changes will likely get overridden, but feel free to update the PR with the requested changes and we can get it merged.
src/index.d.ts
Outdated
| } | ||
|
|
||
| type AddOperation = { | ||
| opp: string; |
There was a problem hiding this comment.
Seems like these should be op and not opp (on all the operations)?
|
|
||
| export type Operation = AddOperation | RemoveOperation | ReplaceOperation | MoveOperation | ||
|
|
||
| export interface JSONPatchFormatter { |
There was a problem hiding this comment.
Ideally JSONPatchFormatter would inherit from Formatter, but we can handle that in a future PR.
|
@Methuselah96 for now we found our way around - looking forward to see the migration happening :) |
Add type definition for JSON Patch formatter matching official
Operationdefinition from http://jsonpatch.com