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

tree<y>.calculatePatch(otherTree<x>) types could be improved, so that it returns a Patch<Y | X> #95

Open
stefanpenner opened this issue Aug 10, 2021 · 0 comments

Comments

@stefanpenner
Copy link
Owner

stefanpenner commented Aug 10, 2021

When using calculatePatch today, the resulting patches incorrectly type their entry as DefaultEntry, when ideally the resulting Patch[] would be generic based on the actually tree's being used. Basically something like: Patch<T | K>[]

today:

class FSTree<T> {
  calculatePatch<K extends BaseEntry>(theirFSTree: FSTree<K>, isEqual?: (a: T, b: K) => boolean): FSTree.Patch {
  
  }
}

Proposed:

class FSTree<T> {
  calculatePatch<K extends BaseEntry>(theirFSTree: FSTree<K>, isEqual?: (a: T, b: K) => boolean): FSTree.Patch<T | K> {
  
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant