You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey Staltz, I was wondering if you'd be open to exporting two interface subtypes of Stream<A>, one that contains all of the methods that are contravariant in A maybe called Sink<A> and one that contains all of the methods that are covariant in A maybe called Source<A>. This would allow for proper subtyping of methods that are expecting source / sink streams as Stream<A> is currently invariant in A.
/* Type 'Stream<3>' is not assignable to type 'Stream<number>'. Types of property '_ils' are incompatible. Type 'InternalListener<3>[]' is not assignable to type 'InternalListener<number>[]'. Type 'InternalListener<3>' is not assignable to type 'InternalListener<number>'. Type 'number' is not assignable to type '3'.*/constnumber$: xs.Stream<number>=xs.Stream.of(3asconst)
More concretely, we have a general event sink that expects events payloads of a certain generic structure, and then a system generating events with a more specific type, e.g. a string literal for the event type.
Hey Staltz, I was wondering if you'd be open to exporting two interface subtypes of
Stream<A>
, one that contains all of the methods that are contravariant inA
maybe calledSink<A>
and one that contains all of the methods that are covariant inA
maybe calledSource<A>
. This would allow for proper subtyping of methods that are expecting source / sink streams asStream<A>
is currently invariant inA
.For example
Most of the covariant methods on
Stream<A>
are static, with the exception ofremember
anddebug
. So the Source type makes less sense.The text was updated successfully, but these errors were encountered: