feat(common): introduce KeyValuePipe (#24319)

PR Close #24319
This commit is contained in:
Fabian Wiles
2018-06-06 21:31:22 +12:00
committed by Miško Hevery
parent 92b278c097
commit 2b49bf77af
9 changed files with 332 additions and 6 deletions

View File

@ -22,7 +22,7 @@ export interface KeyValueDiffer<K, V> {
* @returns an object describing the difference. The return value is only valid until the next
* `diff()` invocation.
*/
diff(object: Map<K, V>): KeyValueChanges<K, V>;
diff(object: Map<K, V>): KeyValueChanges<K, V>|null;
/**
* Compute a difference between the previous state and the new `object` state.
@ -31,7 +31,7 @@ export interface KeyValueDiffer<K, V> {
* @returns an object describing the difference. The return value is only valid until the next
* `diff()` invocation.
*/
diff(object: {[key: string]: V}): KeyValueChanges<string, V>;
diff(object: {[key: string]: V}): KeyValueChanges<string, V>|null;
// TODO(TS2.1): diff<KP extends string>(this: KeyValueDiffer<KP, V>, object: Record<KP, V>):
// KeyValueDiffer<KP, V>;
}