Closed tbosch closed 8 years ago
Dart has temporary syntax for generic methods now that we should be able to emit TypeScript generic methods/functions/typedefs to. Let's do that.
@yjbanov do you have a pointer to docs?
@jacob314 might have some
@mprobst Hi, could you have a look at this?
This is supported since quite a bit, it'll translate generic parameters on methods into Dart DDC's comment syntax.
Just checked with the current version. If I write
createEmbeddedView<C>(templateRef: TempalteRef<C>, context: C, index: number):EmbeddedViewRef<C>
I am getting this:
EmbeddedViewRef<C> createEmbeddedView/*< C >*/(TemplateRef<C> templateRef,
[C context, num index]);
It would be nice to write something like this:
and have the following in Dart:
This is needed in Angular e.g. for
ViewContainerRef.createEmbeddedView
: I would like to write this:But right now ts2dart outputs this:
The tricky bit here is that this output of ts2dart would be correct if
ViewContainerRef
had a genericC
declared on itself (e.g.class ViewContainerRef<C> { ...}
). However, in this case, the generic originates just from the method itself.