Subject and BehaviorSubject should have input and output types #7507
dariomannu
started this conversation in
Ideas / Feature request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently both Subject and BehaviorSubject have a single type parameter.
This is in sheer contrast with the typical use case of both, which is to transform inputs into outputs potentially of a different type via pipelines.
Both should really be typed like
Subject<I, O=I>
andBehaviorSubject<I, O=I>
, where I is the input type, and O the output type.If no pipeline is attached, O would be obviously equal to I, otherwise:
This concept is based on the idea from #7506 that
Subject().pipe()
should be itself of typeSubject
andBehaviorSubject().pipe()
should be itself of typeBehaviorSubject
, unless... that's challenged by anyone?Beta Was this translation helpful? Give feedback.
All reactions