Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Allow subtypes of EventEmitters in @Outputs #76

Closed
MichaelRFairhurst opened this issue Nov 20, 2016 · 4 comments
Closed

Allow subtypes of EventEmitters in @Outputs #76

MichaelRFairhurst opened this issue Nov 20, 2016 · 4 comments

Comments

@MichaelRFairhurst
Copy link
Contributor

MichaelRFairhurst commented Nov 20, 2016

Currently, code such as

class MyEventEmitter<T> extends EventEmitter<T> { ... }

...
   @Output MyEventEmitter<int> intEvents;

will fail.

Per @scheglov, its possible that EventEmitter itself is already a subtype of the required type, which may be simply Stream<T>.

Note as well that we should do this right, tracking where the subtype relationship specifies the type parameters, ie

class MyIntEventEmitter extends EventEmitter<int> { ... }

If this is considerably more work then a new ticket should be made for this edge case.

@MichaelRFairhurst
Copy link
Contributor Author

Upping the importance of this for two reasons: Firstly, per some discovery showing it comes up a lot. Secondly, when this goes wrong it currently has no fallback behavior and it complains about the $event variables when it can't identify their type.

Also confirmed that Stream is the required type, not EventEmitter.

Therefore the goals are twofold:

  1. support subtypes of Stream<T> while allowing for classes to specialized Streams (ie, extends Stream<int>), and
  2. use dynamic type when the event type can't be found

@scheglov
Copy link
Contributor

scheglov commented Nov 24, 2016

@MichaelRFairhurst
Copy link
Contributor Author

Ah! That is exactly what I was hoping would exist!

MichaelRFairhurst added a commit to MichaelRFairhurst/angular2-dart-analyzer that referenced this issue Nov 28, 2016
Use the mostSpecificTypeArgument method API to get the stream type
regardless of the inheritance tree and generics defined within it.
MichaelRFairhurst added a commit that referenced this issue Nov 28, 2016
* Allow Stream<T> and subtypes of it in outputs, refs #76

Use the mostSpecificTypeArgument method API to get the stream type
regardless of the inheritance tree and generics defined within it.

Plus style fixes including in some old code
@MichaelRFairhurst
Copy link
Contributor Author

PR #89 merged

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants