Skip to content

Commit

Permalink
test(dtslint): add fromEvent dtslint test (ReactiveX#4093)
Browse files Browse the repository at this point in the history
  • Loading branch information
dkosasih committed Feb 28, 2019
1 parent 877b008 commit 5ea37b4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions spec-dtslint/observables/fromEvent-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { fromEvent } from 'rxjs';
import { NodeStyleEventEmitter, HasEventTargetAddRemove } from '../../src/internal/observable/fromEvent';

const hasEventTargetAddRemove: HasEventTargetAddRemove<string> = {
addEventListener: (type, listener, options?) => { },
removeEventListener: (type, listener, options?) => { }
};

const nodeStyleEventEmitter: NodeStyleEventEmitter = {
addListener: (eventName, handler) => nodeStyleEventEmitter ,
removeListener: (eventName, handler) => nodeStyleEventEmitter
};

it('should infer correctly with HasEventTargetAddRemove event type', () => {
const a = fromEvent(hasEventTargetAddRemove, 'foo'); // $ExpectType Observable<string>
});

it('should infer correctly with NodeStyleEventEmitter event type', () => {
const a = fromEvent(document, 'foo'); // $ExpectType Observable<Event>
});

0 comments on commit 5ea37b4

Please sign in to comment.