-
-
Notifications
You must be signed in to change notification settings - Fork 139
Description
When mergeing streams of component types of a discriminating union the internal listener seems to be trying to assign a variable of the compound type to a variable of a component type.
You can see in the example repository I made that typechecking produces the following error:
index.ts:17:7 - error TS2322: Type 'Stream<FirstComponentType>' is not assignable to type 'Stream<CompoundType>'.
Types of property '_ils' are incompatible.
Type 'InternalListener<FirstComponentType>[]' is not assignable to type 'InternalListener<CompoundType>[]'.
Type 'InternalListener<FirstComponentType>' is not assignable to type 'InternalListener<CompoundType>'.
Type 'CompoundType' is not assignable to type 'FirstComponentType'.
Type 'SecondComponentType' is not assignable to type 'FirstComponentType'.
Basically, it seems like merge won't output types compatible with the CompoundType even when all of it's input stream are of component types. It works if merge contains all of the component types however. You can test it by adding second$ to the xs.merge call.
Is this intentional for a reason I don't understand, or is it a bug? I ran into it while converting DOM events into Actions to feed into my reducer function in a cyclejs app.
EDIT: Might be related to #262 (comment)