angular_analyzer_plugin
angular_analyzer_plugin copied to clipboard
Correct validation of bindings to generic components and directives
Note this issue is being filed preemptively, as support for generics will be added in the upcoming release of package:angular v5.1.0.
Issue
An incorrect error is shown when binding to a property with a generic-bounded, generic type.
Reproduction
@Component(
selector: 'list',
template: '',
)
class ListComponent<T extends Iterable<E>, E> {
@Input()
T values;
}
@Component(
selector: 'example',
template: '<list [values]="values"></list>',
^^^^^^
directives: [ListComponent],
directiveTypes: [Typed<ListComponent<List<int>, int>>()],
)
class ExampleComponent {
final values = [1, 2];
}
The above code is valid, but the following error is raised:
Attribute value expression (of type List<int>) is not assignable to component input (of type Iterable<R>) [input_binding_type_error]