-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Description
/* @flow */
type Observable<T> = { observe(observer: Observer<T>): void }
type Observer<T> = { next(x: T): void }
type Subject<T> = Observable<T> & Observer<T>
function createSubject<T>(): Subject<T> {
var observers = []
return {
observe(observer) {
observers.push(observer)
},
next(x) {
for (var i = 0; i < observers.length; i++) {
observers[i].next(x)
}
}
}
}
type Test = {
foo: Observable<string>
}
function test(): Test {
var foo: Subject<string> = createSubject()
return { foo }
}
test2.js|5 col 19 error| intersection type
|| This type is incompatible with
test2.js|3 col 22 error| object type
||
test2.js|5 col 19 error| intersection type
|| This type is incompatible with
test2.js|4 col 20 error| object type
||
Metadata
Metadata
Assignees
Labels
No labels