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

WIP: Add better type definitions #88

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

WIP: Add better type definitions #88

wants to merge 1 commit into from

Conversation

mattphillips
Copy link
Owner

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

@codecov-commenter
Copy link

codecov-commenter commented Nov 12, 2022

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (e37b759) to head (8a8138f).
Report is 3 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

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           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

2 participants