Skip to content

Commit

Permalink
refactor(core): strict templates type-checking compatibility for perf…
Browse files Browse the repository at this point in the history
… tests (#44905)

This commit updates a type used in the transplanted views perf tests, to make the test compatible with strict template type-checking.

Currently, compiling the perf test results in the following TS error:
```
error TS2322: Type 'TemplateRef<{}>' is not assignable to type 'TemplateRef<NgForOfContext<any, any[]>>'.

17     <ng-container *ngFor="let n of views; template: template; trackBy: trackByIndex"></ng-container>
                                             ~~~~~~~~
```

PR Close #44905
  • Loading branch information
AndrewKushnir authored and thePunderWoman committed Jan 31, 2022
1 parent 1aebbf8 commit 98ba48e
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {NgForOfContext} from '@angular/common';
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, NgModule, TemplateRef, ViewChild} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';

Expand All @@ -19,7 +20,7 @@ import {newArray} from '../util';
changeDetection: ChangeDetectionStrategy.OnPush
})
export class InsertionComponent {
@Input() template !: TemplateRef<{}>;
@Input() template!: TemplateRef<NgForOfContext<any, any[]>>;
views: any[] = [];
@Input()
set viewCount(n: number) {
Expand Down

0 comments on commit 98ba48e

Please sign in to comment.