-
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.
- Ensures Notification methods only accept appropriate arguments - Ensures Arbitrary objects of the proper shape my be passed through dematerialized - Utilizes hot path functions to create lightweight objects for internal notification use - Deprecates the Notification class - Adds a deprecation message for materialize to notify users that soon the emitted object type will change to not have all of the same methods as Notification - Updates a few tests that were relying on the shape of Notification instances to pass, as we are now using POJOs internally in the TestScheduler - Adds dtslint tests for notifications - Adds dtslint tests to enforce types on dematerialize BREAKING CHANGE: Notification.createNext(undefined) will no longer return the exact same reference everytime. BREAKING CHANGE: Type signatures tightened up around Notification and dematerialize
- Loading branch information
Showing
17 changed files
with
541 additions
and
280 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Notification } from "../dist/types/internal/Notification"; | ||
|
||
describe('Notification', () => { | ||
// Basic method tests | ||
const nextNotification = Notification.createNext('a'); // $ExpectType Notification<string> & NextNotification<string> | ||
nextNotification.do((value: number) => {}); // $ExpectError | ||
const r = nextNotification.do((value: string) => {}); // $ExpectType void | ||
const r1 = nextNotification.observe({ next: value => { } }); // $ExpectType void | ||
const r2 = nextNotification.observe({ next: (value: number) => { } }); // $ExpectError | ||
const r3 = nextNotification.toObservable(); // $ExpectType Observable<string> | ||
const k1 = nextNotification.kind; // $ExpectType "N" | ||
|
||
const completeNotification = Notification.createComplete(); // $ExpectType Notification<never> & CompleteNotification | ||
const r4 = completeNotification.do((value: string) => {}); // $ExpectType void | ||
const r5 = completeNotification.observe({ next: value => { } }); // $ExpectType void | ||
const r6 = completeNotification.observe({ next: (value: number) => { } }); // $ExpectType void | ||
const r7 = completeNotification.toObservable(); // $ExpectType Observable<never> | ||
const k2 = completeNotification.kind; // $ExpectType "C" | ||
|
||
const errorNotification = Notification.createError(); // $ExpectType Notification<never> & ErrorNotification | ||
const r8 = errorNotification.do((value: string) => {}); // $ExpectType void | ||
const r9 = errorNotification.observe({ next: value => { } }); // $ExpectType void | ||
const r10 = errorNotification.observe({ next: (value: number) => { } }); // $ExpectType void | ||
const r11 = errorNotification.toObservable(); // $ExpectType Observable<never> | ||
const k3 = errorNotification.kind; // $ExpectType "E" | ||
}); |
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
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
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
Oops, something went wrong.