diff --git a/packages/common/src/directives/ng_for_of.ts b/packages/common/src/directives/ng_for_of.ts index 205581224db0ad..0d3b21890b3707 100644 --- a/packages/common/src/directives/ng_for_of.ts +++ b/packages/common/src/directives/ng_for_of.ts @@ -168,12 +168,9 @@ export class NgForOf = NgIterable> implements DoCh @Input() set ngForTrackBy(fn: TrackByFunction) { if (NG_DEV_MODE && fn != null && typeof fn !== 'function') { - // TODO(vicb): use a log service once there is a public one available - if (console && console.warn) { - console.warn( - `trackBy must be a function, but received ${JSON.stringify(fn)}. ` + - `See https://angular.io/api/common/NgForOf#change-propagation for more information.`); - } + console.warn( + `trackBy must be a function, but received ${JSON.stringify(fn)}. ` + + `See https://angular.io/api/common/NgForOf#change-propagation for more information.`); } this._trackByFn = fn; } @@ -185,7 +182,9 @@ export class NgForOf = NgIterable> implements DoCh private _ngForOf: U|undefined|null = null; private _ngForOfDirty: boolean = true; private _differ: IterableDiffer|null = null; - // TODO(issue/24571): remove '!'. + // TODO(issue/24571): remove '!' + // waiting for microsoft/typescript#43662 to allow the return type `TrackByFunction|undefined` for + // the getter private _trackByFn!: TrackByFunction; constructor(