forked from angulardart/angular
-
Notifications
You must be signed in to change notification settings - Fork 15
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
Consider the following code (from _tests/test/common/directives/for_test.dart
):
// for_test.dart
void main() {
group('ngFor', () {
tearDown(() => disposeAnyRunningTest());
test('should reflect initial elements', () async {
var testBed = NgTestBed(ng.createNgForItemsTestFactory());
var testFixture = await testBed.create();
expect(testFixture.rootElement, hasTextContent('1;2;3;'));
});
);
}
@Component(
selector: 'ngfor-items-test',
template: '<div><copy-me *ngFor="let item of items">'
'{{item.toString()}};</copy-me></div>',
directives: [
CopyMe,
NgFor,
],
)
class NgForItemsTest extends BaseTestComponent {
@ContentChild(TemplateRef)
TemplateRef? contentTpl;
}
An analysis error is thrown on NgTestBed
: Couldn't infer type parameter 'T'
. However, when checking the generate template code, the function createNgForItemsTestFactory()
clearly returns a type that is not dynamic:
ComponentFactory<import1.NgForItemsTest> createNgForItemsTestFactory() {
return ComponentFactory('ngfor-items-test', viewFactory_NgForItemsTestHost0);
}
where import1
is imported as import 'for_test.dart' as import1;
This is not a huge problem as the developer merely needs to change NgTestBed
into NgTestBed<NgForItems>
, but this can be very counter-productive for those working on old code (like us), which stops them from performing analysis on the packages (25b75dd).
Dart SDK: 2.17.0
AngularDart: 7.1.0
OS: agnostic
Browser: n/a
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed