refactor(common): add defaults to new generic parameters (#34206)

This is a follow-up to #33997 where some new generic parameters were added without defaults which is technically a breaking change. These changes add the defaults.

PR Close #34206
This commit is contained in:
Kristiyan Kostadinov
2019-12-03 11:59:46 +01:00
committed by Miško Hevery
parent 9b6a1b85b1
commit cca2616637
4 changed files with 12 additions and 12 deletions

View File

@ -11,7 +11,7 @@ import {Directive, DoCheck, EmbeddedViewRef, Input, IterableChangeRecord, Iterab
/**
* @publicApi
*/
export class NgForOfContext<T, U extends NgIterable<T>> {
export class NgForOfContext<T, U extends NgIterable<T> = NgIterable<T>> {
constructor(public $implicit: T, public ngForOf: U, public index: number, public count: number) {}
get first(): boolean { return this.index === 0; }
@ -121,7 +121,7 @@ export class NgForOfContext<T, U extends NgIterable<T>> {
* @publicApi
*/
@Directive({selector: '[ngFor][ngForOf]'})
export class NgForOf<T, U extends NgIterable<T>> implements DoCheck {
export class NgForOf<T, U extends NgIterable<T> = NgIterable<T>> implements DoCheck {
/**
* The value of the iterable expression, which can be used as a
* [template input variable](guide/structural-directives#template-input-variable).

View File

@ -149,7 +149,7 @@ import {Directive, EmbeddedViewRef, Input, TemplateRef, ViewContainerRef, ɵstri
* @publicApi
*/
@Directive({selector: '[ngIf]'})
export class NgIf<T> {
export class NgIf<T = unknown> {
private _context: NgIfContext<T> = new NgIfContext<T>();
private _thenTemplateRef: TemplateRef<NgIfContext<T>>|null = null;
private _elseTemplateRef: TemplateRef<NgIfContext<T>>|null = null;
@ -238,7 +238,7 @@ export class NgIf<T> {
/**
* @publicApi
*/
export class NgIfContext<T> {
export class NgIfContext<T = unknown> {
public $implicit: T = null !;
public ngIf: T = null !;
}