-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(distinctUntilKeyChanged): improved key typing with keyof T (#3988)
* fix(distinctUntilKeyChanged): correct signatures * chore(distinctUntilKeyChanged): nail down key's typing with keyof T
- Loading branch information
Showing
4 changed files
with
32 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { of } from 'rxjs'; | ||
import { distinctUntilKeyChanged } from 'rxjs/operators'; | ||
|
||
const sample = {name: 'foobar', num: 42}; | ||
|
||
it('should enforce key set', () => { | ||
const o = of(sample).pipe(distinctUntilKeyChanged('something')); // $ExpectError | ||
}); | ||
|
||
it('should enforce key set with compare', () => { | ||
const o = of(sample).pipe(distinctUntilKeyChanged('something', () => true)); // $ExpectError | ||
}); | ||
|
||
it("should enforce compare's type", () => { | ||
const o = of(sample).pipe(distinctUntilKeyChanged('name', (a: number, b: number) => true)); // $ExpectError | ||
}); | ||
|
||
it("should enforce key set and compare's type", () => { | ||
const o = of(sample).pipe(distinctUntilKeyChanged('something', (a: number, b: number) => true)); // $ExpectError | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters