deep-object-diff icon indicating copy to clipboard operation
deep-object-diff copied to clipboard

WIP: Add better type definitions

Open mattphillips opened this issue 2 years ago • 1 comments

This is a bit of a POC to add type definitions for each diff function that works correctly.

I've not exhaustively tested this yet so don't know if it covers all cases but the general idea is as follows:

  • diff: Merge the left hand side and right hand side types into optionals at all levels and convert arrays to dictionaries (recursing on the inferred array element type)
  • added: Keep all new RHS keys and set all old LHS keys to never. All new new at any level should not be optional. Arrays can also have been inserted into so they should be kept in the types but made optional dictionaries.
  • deleted: Keep all keys that are not present on the RHS keys but exist in the LHS as undefined. Arrays can also have been deleted from so they should be kept in the types but made optional dictionaries.
  • updated: TODO

mattphillips avatar Nov 12 '22 13:11 mattphillips

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage :thumbsup:

Coverage data is based on head (8a8138f) compared to base (e37b759). Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #88   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          109       109           
  Branches        36        36           
=========================================
  Hits           109       109           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov-commenter avatar Nov 12 '22 13:11 codecov-commenter