Skip to content

Commit 861e950

Browse files
committed
Fix watchWithTime type
1 parent c80bbef commit 861e950

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

kefir-test-utils.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export type Event<V, E> = KEvent<V, E> & {
55
current?: boolean
66
}
77

8+
export type EventWithTime<V, E> = [number, Event<V, E>]
9+
810
export type Options = {current: boolean}
911

1012
export type Watcher<V, E> = {
@@ -29,7 +31,7 @@ export interface Helpers {
2931
withFakeTime(cb: (tick: (x: number) => void, clock: Clock) => void, reverseSimultaneous?: boolean): void
3032
logItem<V, E>(event: KEvent<V, E>, current: boolean): Event<V, E>
3133
watch<V, E>(obs: Observable<V, E>): Watcher<V, E>
32-
watchWithTime<V, E>(stream$: Observable<V, E>): Event<V, E>[]
34+
watchWithTime<V, E>(stream$: Observable<V, E>): EventWithTime<V, E>[]
3335
}
3436

3537
export interface HelpersFactory {

kefir-test-utils.test-d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {expectType} from 'tsd'
22
import Kefir from 'kefir'
33
import {Clock} from 'lolex'
4-
import createHelpers, {Event, Watcher} from '.'
4+
import createHelpers, {Event, Watcher, EventWithTime} from '.'
55

66
const {VALUE, ERROR, END, value, error, end, withFakeTime, logItem, watch, watchWithTime} = createHelpers(Kefir)
77

@@ -21,4 +21,5 @@ expectType<void>(
2121
)
2222
expectType<Event<string, number>>(logItem({type: 'value', value: 'hello'}, false))
2323
expectType<Watcher<string, number>>(watch(new Kefir.Stream<string, number>()))
24-
expectType<Event<string, number>[]>(watchWithTime(new Kefir.Stream<string, number>()))
24+
expectType<EventWithTime<string, any>>([10, value('hello')])
25+
expectType<EventWithTime<string, number>[]>(watchWithTime(new Kefir.Stream<string, number>()))

0 commit comments

Comments
 (0)