fix(common): Update types for TypeScript nullability support
This commit is contained in:
parent
4c566dbfbb
commit
d8b73e4223
|
@ -38,8 +38,8 @@ import {Directive, DoCheck, ElementRef, Input, IterableChanges, IterableDiffer,
|
||||||
*/
|
*/
|
||||||
@Directive({selector: '[ngClass]'})
|
@Directive({selector: '[ngClass]'})
|
||||||
export class NgClass implements DoCheck {
|
export class NgClass implements DoCheck {
|
||||||
private _iterableDiffer: IterableDiffer<string>;
|
private _iterableDiffer: IterableDiffer<string>|null;
|
||||||
private _keyValueDiffer: KeyValueDiffer<string, any>;
|
private _keyValueDiffer: KeyValueDiffer<string, any>|null;
|
||||||
private _initialClasses: string[] = [];
|
private _initialClasses: string[] = [];
|
||||||
private _rawClass: string[]|Set<string>|{[klass: string]: any};
|
private _rawClass: string[]|Set<string>|{[klass: string]: any};
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,8 @@ export class NgComponentOutlet implements OnChanges, OnDestroy {
|
||||||
@Input() ngComponentOutletContent: any[][];
|
@Input() ngComponentOutletContent: any[][];
|
||||||
@Input() ngComponentOutletNgModuleFactory: NgModuleFactory<any>;
|
@Input() ngComponentOutletNgModuleFactory: NgModuleFactory<any>;
|
||||||
|
|
||||||
private _componentRef: ComponentRef<any> = null;
|
private _componentRef: ComponentRef<any>|null = null;
|
||||||
private _moduleRef: NgModuleRef<any> = null;
|
private _moduleRef: NgModuleRef<any>|null = null;
|
||||||
|
|
||||||
constructor(private _viewContainerRef: ViewContainerRef) {}
|
constructor(private _viewContainerRef: ViewContainerRef) {}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ export class NgForOf<T> implements DoCheck, OnChanges {
|
||||||
|
|
||||||
get ngForTrackBy(): TrackByFunction<T> { return this._trackByFn; }
|
get ngForTrackBy(): TrackByFunction<T> { return this._trackByFn; }
|
||||||
|
|
||||||
private _differ: IterableDiffer<T> = null;
|
private _differ: IterableDiffer<T>|null = null;
|
||||||
private _trackByFn: TrackByFunction<T>;
|
private _trackByFn: TrackByFunction<T>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
@ -159,13 +159,13 @@ export class NgForOf<T> implements DoCheck, OnChanges {
|
||||||
(item: IterableChangeRecord<any>, adjustedPreviousIndex: number, currentIndex: number) => {
|
(item: IterableChangeRecord<any>, adjustedPreviousIndex: number, currentIndex: number) => {
|
||||||
if (item.previousIndex == null) {
|
if (item.previousIndex == null) {
|
||||||
const view = this._viewContainer.createEmbeddedView(
|
const view = this._viewContainer.createEmbeddedView(
|
||||||
this._template, new NgForOfContext(null, this.ngForOf, null, null), currentIndex);
|
this._template, new NgForOfContext<T>(null !, this.ngForOf, -1, -1), currentIndex);
|
||||||
const tuple = new RecordViewTuple(item, view);
|
const tuple = new RecordViewTuple<T>(item, view);
|
||||||
insertTuples.push(tuple);
|
insertTuples.push(tuple);
|
||||||
} else if (currentIndex == null) {
|
} else if (currentIndex == null) {
|
||||||
this._viewContainer.remove(adjustedPreviousIndex);
|
this._viewContainer.remove(adjustedPreviousIndex);
|
||||||
} else {
|
} else {
|
||||||
const view = this._viewContainer.get(adjustedPreviousIndex);
|
const view = this._viewContainer.get(adjustedPreviousIndex) !;
|
||||||
this._viewContainer.move(view, currentIndex);
|
this._viewContainer.move(view, currentIndex);
|
||||||
const tuple = new RecordViewTuple(item, <EmbeddedViewRef<NgForOfContext<T>>>view);
|
const tuple = new RecordViewTuple(item, <EmbeddedViewRef<NgForOfContext<T>>>view);
|
||||||
insertTuples.push(tuple);
|
insertTuples.push(tuple);
|
||||||
|
|
|
@ -102,10 +102,10 @@ import {Directive, EmbeddedViewRef, Input, TemplateRef, ViewContainerRef} from '
|
||||||
@Directive({selector: '[ngIf]'})
|
@Directive({selector: '[ngIf]'})
|
||||||
export class NgIf {
|
export class NgIf {
|
||||||
private _context: NgIfContext = new NgIfContext();
|
private _context: NgIfContext = new NgIfContext();
|
||||||
private _thenTemplateRef: TemplateRef<NgIfContext> = null;
|
private _thenTemplateRef: TemplateRef<NgIfContext>|null = null;
|
||||||
private _elseTemplateRef: TemplateRef<NgIfContext> = null;
|
private _elseTemplateRef: TemplateRef<NgIfContext>|null = null;
|
||||||
private _thenViewRef: EmbeddedViewRef<NgIfContext> = null;
|
private _thenViewRef: EmbeddedViewRef<NgIfContext>|null = null;
|
||||||
private _elseViewRef: EmbeddedViewRef<NgIfContext> = null;
|
private _elseViewRef: EmbeddedViewRef<NgIfContext>|null = null;
|
||||||
|
|
||||||
constructor(private _viewContainer: ViewContainerRef, templateRef: TemplateRef<NgIfContext>) {
|
constructor(private _viewContainer: ViewContainerRef, templateRef: TemplateRef<NgIfContext>) {
|
||||||
this._thenTemplateRef = templateRef;
|
this._thenTemplateRef = templateRef;
|
||||||
|
|
|
@ -61,7 +61,7 @@ export class NgStyle implements DoCheck {
|
||||||
changes.forEachChangedItem((record) => this._setStyle(record.key, record.currentValue));
|
changes.forEachChangedItem((record) => this._setStyle(record.key, record.currentValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _setStyle(nameAndUnit: string, value: string|number): void {
|
private _setStyle(nameAndUnit: string, value: string|number|null|undefined): void {
|
||||||
const [name, unit] = nameAndUnit.split('.');
|
const [name, unit] = nameAndUnit.split('.');
|
||||||
value = value != null && unit ? `${value}${unit}` : value;
|
value = value != null && unit ? `${value}${unit}` : value;
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,8 @@ export class HashLocationStrategy extends LocationStrategy {
|
||||||
}
|
}
|
||||||
|
|
||||||
pushState(state: any, title: string, path: string, queryParams: string) {
|
pushState(state: any, title: string, path: string, queryParams: string) {
|
||||||
let url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
|
let url: string|null =
|
||||||
|
this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
|
||||||
if (url.length == 0) {
|
if (url.length == 0) {
|
||||||
url = this._platformLocation.pathname;
|
url = this._platformLocation.pathname;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,8 +128,8 @@ export class Location {
|
||||||
* Subscribe to the platform's `popState` events.
|
* Subscribe to the platform's `popState` events.
|
||||||
*/
|
*/
|
||||||
subscribe(
|
subscribe(
|
||||||
onNext: (value: PopStateEvent) => void, onThrow: (exception: any) => void = null,
|
onNext: (value: PopStateEvent) => void, onThrow?: ((exception: any) => void)|null,
|
||||||
onReturn: () => void = null): Object {
|
onReturn?: (() => void)|null): Object {
|
||||||
return this._subject.subscribe({next: onNext, error: onThrow, complete: onReturn});
|
return this._subject.subscribe({next: onNext, error: onThrow, complete: onReturn});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,9 @@ export abstract class PlatformLocation {
|
||||||
abstract onPopState(fn: LocationChangeListener): void;
|
abstract onPopState(fn: LocationChangeListener): void;
|
||||||
abstract onHashChange(fn: LocationChangeListener): void;
|
abstract onHashChange(fn: LocationChangeListener): void;
|
||||||
|
|
||||||
get pathname(): string { return null; }
|
abstract get pathname(): string;
|
||||||
get search(): string { return null; }
|
abstract get search(): string;
|
||||||
get hash(): string { return null; }
|
abstract get hash(): string;
|
||||||
|
|
||||||
abstract replaceState(state: any, title: string, url: string): void;
|
abstract replaceState(state: any, title: string, url: string): void;
|
||||||
|
|
||||||
|
|
|
@ -8,33 +8,34 @@
|
||||||
|
|
||||||
import {ChangeDetectorRef, EventEmitter, OnDestroy, Pipe, PipeTransform, WrappedValue, ɵisObservable, ɵisPromise} from '@angular/core';
|
import {ChangeDetectorRef, EventEmitter, OnDestroy, Pipe, PipeTransform, WrappedValue, ɵisObservable, ɵisPromise} from '@angular/core';
|
||||||
import {Observable} from 'rxjs/Observable';
|
import {Observable} from 'rxjs/Observable';
|
||||||
|
import {ISubscription} from 'rxjs/Subscription';
|
||||||
import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
|
import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
|
||||||
|
|
||||||
interface SubscriptionStrategy {
|
interface SubscriptionStrategy {
|
||||||
createSubscription(async: any, updateLatestValue: any): any;
|
createSubscription(async: Observable<any>|Promise<any>, updateLatestValue: any): ISubscription
|
||||||
dispose(subscription: any): void;
|
|Promise<any>;
|
||||||
onDestroy(subscription: any): void;
|
dispose(subscription: ISubscription|Promise<any>): void;
|
||||||
|
onDestroy(subscription: ISubscription|Promise<any>): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ObservableStrategy implements SubscriptionStrategy {
|
class ObservableStrategy implements SubscriptionStrategy {
|
||||||
createSubscription(async: any, updateLatestValue: any): any {
|
createSubscription(async: Observable<any>, updateLatestValue: any): ISubscription {
|
||||||
return async.subscribe({next: updateLatestValue, error: (e: any) => { throw e; }});
|
return async.subscribe({next: updateLatestValue, error: (e: any) => { throw e; }});
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose(subscription: any): void { subscription.unsubscribe(); }
|
dispose(subscription: ISubscription): void { subscription.unsubscribe(); }
|
||||||
|
|
||||||
onDestroy(subscription: any): void { subscription.unsubscribe(); }
|
onDestroy(subscription: ISubscription): void { subscription.unsubscribe(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class PromiseStrategy implements SubscriptionStrategy {
|
class PromiseStrategy implements SubscriptionStrategy {
|
||||||
createSubscription(async: Promise<any>, updateLatestValue: (v: any) => any): any {
|
createSubscription(async: Promise<any>, updateLatestValue: (v: any) => any): Promise<any> {
|
||||||
return async.then(updateLatestValue, e => { throw e; });
|
return async.then(updateLatestValue, e => { throw e; });
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose(subscription: any): void {}
|
dispose(subscription: Promise<any>): void {}
|
||||||
|
|
||||||
onDestroy(subscription: any): void {}
|
onDestroy(subscription: Promise<any>): void {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const _promiseStrategy = new PromiseStrategy();
|
const _promiseStrategy = new PromiseStrategy();
|
||||||
|
@ -67,12 +68,12 @@ const _observableStrategy = new ObservableStrategy();
|
||||||
*/
|
*/
|
||||||
@Pipe({name: 'async', pure: false})
|
@Pipe({name: 'async', pure: false})
|
||||||
export class AsyncPipe implements OnDestroy, PipeTransform {
|
export class AsyncPipe implements OnDestroy, PipeTransform {
|
||||||
private _latestValue: Object = null;
|
private _latestValue: any = null;
|
||||||
private _latestReturnedValue: Object = null;
|
private _latestReturnedValue: any = null;
|
||||||
|
|
||||||
private _subscription: Object = null;
|
private _subscription: ISubscription|Promise<any>|null = null;
|
||||||
private _obj: Observable<any>|Promise<any>|EventEmitter<any> = null;
|
private _obj: Observable<any>|Promise<any>|EventEmitter<any>|null = null;
|
||||||
private _strategy: SubscriptionStrategy = null;
|
private _strategy: SubscriptionStrategy = null !;
|
||||||
|
|
||||||
constructor(private _ref: ChangeDetectorRef) {}
|
constructor(private _ref: ChangeDetectorRef) {}
|
||||||
|
|
||||||
|
@ -82,10 +83,11 @@ export class AsyncPipe implements OnDestroy, PipeTransform {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
transform<T>(obj: null): null;
|
||||||
|
transform<T>(obj: undefined): undefined;
|
||||||
transform<T>(obj: Observable<T>): T|null;
|
transform<T>(obj: Observable<T>): T|null;
|
||||||
transform<T>(obj: Promise<T>): T|null;
|
transform<T>(obj: Promise<T>): T|null;
|
||||||
transform<T>(obj: EventEmitter<T>): T|null;
|
transform(obj: Observable<any>|Promise<any>|null|undefined): any {
|
||||||
transform(obj: Observable<any>|Promise<any>|EventEmitter<any>): any {
|
|
||||||
if (!this._obj) {
|
if (!this._obj) {
|
||||||
if (obj) {
|
if (obj) {
|
||||||
this._subscribe(obj);
|
this._subscribe(obj);
|
||||||
|
@ -127,7 +129,7 @@ export class AsyncPipe implements OnDestroy, PipeTransform {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _dispose(): void {
|
private _dispose(): void {
|
||||||
this._strategy.dispose(this._subscription);
|
this._strategy.dispose(this._subscription !);
|
||||||
this._latestValue = null;
|
this._latestValue = null;
|
||||||
this._latestReturnedValue = null;
|
this._latestReturnedValue = null;
|
||||||
this._subscription = null;
|
this._subscription = null;
|
||||||
|
|
|
@ -100,7 +100,7 @@ export class DatePipe implements PipeTransform {
|
||||||
|
|
||||||
constructor(@Inject(LOCALE_ID) private _locale: string) {}
|
constructor(@Inject(LOCALE_ID) private _locale: string) {}
|
||||||
|
|
||||||
transform(value: any, pattern: string = 'mediumDate'): string {
|
transform(value: any, pattern: string = 'mediumDate'): string|null {
|
||||||
let date: Date;
|
let date: Date;
|
||||||
|
|
||||||
if (isBlank(value) || value !== value) return null;
|
if (isBlank(value) || value !== value) return null;
|
||||||
|
@ -130,7 +130,7 @@ export class DatePipe implements PipeTransform {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDate(date)) {
|
if (!isDate(date)) {
|
||||||
let match: RegExpMatchArray;
|
let match: RegExpMatchArray|null;
|
||||||
if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
|
if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
|
||||||
date = isoStringToDate(match);
|
date = isoStringToDate(match);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -28,7 +28,7 @@ import {invalidPipeArgumentError} from './invalid_pipe_argument_error';
|
||||||
*/
|
*/
|
||||||
@Pipe({name: 'i18nSelect', pure: true})
|
@Pipe({name: 'i18nSelect', pure: true})
|
||||||
export class I18nSelectPipe implements PipeTransform {
|
export class I18nSelectPipe implements PipeTransform {
|
||||||
transform(value: string, mapping: {[key: string]: string}): string {
|
transform(value: string|null|undefined, mapping: {[key: string]: string}): string {
|
||||||
if (value == null) return '';
|
if (value == null) return '';
|
||||||
|
|
||||||
if (typeof mapping !== 'object' || typeof value !== 'string') {
|
if (typeof mapping !== 'object' || typeof value !== 'string') {
|
||||||
|
|
|
@ -20,7 +20,7 @@ export class NumberFormatter {
|
||||||
minimumIntegerDigits?: number,
|
minimumIntegerDigits?: number,
|
||||||
minimumFractionDigits?: number,
|
minimumFractionDigits?: number,
|
||||||
maximumFractionDigits?: number,
|
maximumFractionDigits?: number,
|
||||||
currency?: string,
|
currency?: string|null,
|
||||||
currencyAsSymbol?: boolean
|
currencyAsSymbol?: boolean
|
||||||
} = {}): string {
|
} = {}): string {
|
||||||
const options: Intl.NumberFormatOptions = {
|
const options: Intl.NumberFormatOptions = {
|
||||||
|
@ -31,7 +31,7 @@ export class NumberFormatter {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (style == NumberFormatStyle.Currency) {
|
if (style == NumberFormatStyle.Currency) {
|
||||||
options.currency = currency;
|
options.currency = typeof currency == 'string' ? currency : undefined;
|
||||||
options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code';
|
options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code';
|
||||||
}
|
}
|
||||||
return new Intl.NumberFormat(locale, options).format(num);
|
return new Intl.NumberFormat(locale, options).format(num);
|
||||||
|
@ -192,17 +192,18 @@ function dateFormatter(format: string, date: Date, locale: string): string {
|
||||||
|
|
||||||
if (!parts) {
|
if (!parts) {
|
||||||
parts = [];
|
parts = [];
|
||||||
let match: RegExpExecArray;
|
let match: RegExpExecArray|null;
|
||||||
DATE_FORMATS_SPLIT.exec(format);
|
DATE_FORMATS_SPLIT.exec(format);
|
||||||
|
|
||||||
while (format) {
|
let _format: string|null = format;
|
||||||
match = DATE_FORMATS_SPLIT.exec(format);
|
while (_format) {
|
||||||
|
match = DATE_FORMATS_SPLIT.exec(_format);
|
||||||
if (match) {
|
if (match) {
|
||||||
parts = parts.concat(match.slice(1));
|
parts = parts.concat(match.slice(1));
|
||||||
format = parts.pop();
|
_format = parts.pop() !;
|
||||||
} else {
|
} else {
|
||||||
parts.push(format);
|
parts.push(_format);
|
||||||
format = null;
|
_format = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ const _NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
|
||||||
|
|
||||||
function formatNumber(
|
function formatNumber(
|
||||||
pipe: Type<any>, locale: string, value: number | string, style: NumberFormatStyle,
|
pipe: Type<any>, locale: string, value: number | string, style: NumberFormatStyle,
|
||||||
digits: string, currency: string = null, currencyAsSymbol: boolean = false): string {
|
digits?: string | null, currency: string | null = null,
|
||||||
|
currencyAsSymbol: boolean = false): string|null {
|
||||||
if (value == null) return null;
|
if (value == null) return null;
|
||||||
|
|
||||||
// Convert strings to numbers
|
// Convert strings to numbers
|
||||||
|
@ -23,9 +24,9 @@ function formatNumber(
|
||||||
throw invalidPipeArgumentError(pipe, value);
|
throw invalidPipeArgumentError(pipe, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
let minInt: number;
|
let minInt: number|undefined = undefined;
|
||||||
let minFraction: number;
|
let minFraction: number|undefined = undefined;
|
||||||
let maxFraction: number;
|
let maxFraction: number|undefined = undefined;
|
||||||
if (style !== NumberFormatStyle.Currency) {
|
if (style !== NumberFormatStyle.Currency) {
|
||||||
// rely on Intl default for currency
|
// rely on Intl default for currency
|
||||||
minInt = 1;
|
minInt = 1;
|
||||||
|
@ -89,7 +90,7 @@ function formatNumber(
|
||||||
export class DecimalPipe implements PipeTransform {
|
export class DecimalPipe implements PipeTransform {
|
||||||
constructor(@Inject(LOCALE_ID) private _locale: string) {}
|
constructor(@Inject(LOCALE_ID) private _locale: string) {}
|
||||||
|
|
||||||
transform(value: any, digits: string = null): string {
|
transform(value: any, digits?: string): string|null {
|
||||||
return formatNumber(DecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits);
|
return formatNumber(DecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -118,7 +119,7 @@ export class DecimalPipe implements PipeTransform {
|
||||||
export class PercentPipe implements PipeTransform {
|
export class PercentPipe implements PipeTransform {
|
||||||
constructor(@Inject(LOCALE_ID) private _locale: string) {}
|
constructor(@Inject(LOCALE_ID) private _locale: string) {}
|
||||||
|
|
||||||
transform(value: any, digits: string = null): string {
|
transform(value: any, digits?: string): string|null {
|
||||||
return formatNumber(PercentPipe, this._locale, value, NumberFormatStyle.Percent, digits);
|
return formatNumber(PercentPipe, this._locale, value, NumberFormatStyle.Percent, digits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -153,7 +154,7 @@ export class CurrencyPipe implements PipeTransform {
|
||||||
|
|
||||||
transform(
|
transform(
|
||||||
value: any, currencyCode: string = 'USD', symbolDisplay: boolean = false,
|
value: any, currencyCode: string = 'USD', symbolDisplay: boolean = false,
|
||||||
digits: string = null): string {
|
digits?: string): string|null {
|
||||||
return formatNumber(
|
return formatNumber(
|
||||||
CurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode,
|
CurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode,
|
||||||
symbolDisplay);
|
symbolDisplay);
|
||||||
|
|
|
@ -11,19 +11,19 @@ import {ComponentFixture, TestBed, async} from '@angular/core/testing';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
describe('binding to CSS class list', () => {
|
describe('binding to CSS class list', () => {
|
||||||
let fixture: ComponentFixture<any>;
|
let fixture: ComponentFixture<any>|null;
|
||||||
|
|
||||||
function normalizeClassNames(classes: string) {
|
function normalizeClassNames(classes: string) {
|
||||||
return classes.trim().split(' ').sort().join(' ');
|
return classes.trim().split(' ').sort().join(' ');
|
||||||
}
|
}
|
||||||
|
|
||||||
function detectChangesAndExpectClassName(classes: string): void {
|
function detectChangesAndExpectClassName(classes: string): void {
|
||||||
fixture.detectChanges();
|
fixture !.detectChanges();
|
||||||
let nonNormalizedClassName = fixture.debugElement.children[0].nativeElement.className;
|
let nonNormalizedClassName = fixture !.debugElement.children[0].nativeElement.className;
|
||||||
expect(normalizeClassNames(nonNormalizedClassName)).toEqual(normalizeClassNames(classes));
|
expect(normalizeClassNames(nonNormalizedClassName)).toEqual(normalizeClassNames(classes));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getComponent(): TestComponent { return fixture.debugElement.componentInstance; }
|
function getComponent(): TestComponent { return fixture !.debugElement.componentInstance; }
|
||||||
|
|
||||||
afterEach(() => { fixture = null; });
|
afterEach(() => { fixture = null; });
|
||||||
|
|
||||||
|
@ -74,13 +74,13 @@ export function main() {
|
||||||
|
|
||||||
detectChangesAndExpectClassName('foo');
|
detectChangesAndExpectClassName('foo');
|
||||||
|
|
||||||
objExpr['bar'] = true;
|
objExpr !['bar'] = true;
|
||||||
detectChangesAndExpectClassName('foo bar');
|
detectChangesAndExpectClassName('foo bar');
|
||||||
|
|
||||||
objExpr['baz'] = true;
|
objExpr !['baz'] = true;
|
||||||
detectChangesAndExpectClassName('foo bar baz');
|
detectChangesAndExpectClassName('foo bar baz');
|
||||||
|
|
||||||
delete (objExpr['bar']);
|
delete (objExpr !['bar']);
|
||||||
detectChangesAndExpectClassName('foo baz');
|
detectChangesAndExpectClassName('foo baz');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ export function main() {
|
||||||
|
|
||||||
it('should throw with descriptive error message when CSS class is not a string', () => {
|
it('should throw with descriptive error message when CSS class is not a string', () => {
|
||||||
fixture = createTestComponent(`<div [ngClass]="['foo', {}]"></div>`);
|
fixture = createTestComponent(`<div [ngClass]="['foo', {}]"></div>`);
|
||||||
expect(() => fixture.detectChanges())
|
expect(() => fixture !.detectChanges())
|
||||||
.toThrowError(
|
.toThrowError(
|
||||||
/NgClass can only toggle CSS classes expressed as strings, got \[object Object\]/);
|
/NgClass can only toggle CSS classes expressed as strings, got \[object Object\]/);
|
||||||
});
|
});
|
||||||
|
@ -266,10 +266,10 @@ export function main() {
|
||||||
fixture = createTestComponent('<div [ngClass]="objExpr" class="init foo"></div>');
|
fixture = createTestComponent('<div [ngClass]="objExpr" class="init foo"></div>');
|
||||||
const objExpr = getComponent().objExpr;
|
const objExpr = getComponent().objExpr;
|
||||||
|
|
||||||
objExpr['bar'] = true;
|
objExpr !['bar'] = true;
|
||||||
detectChangesAndExpectClassName('init foo bar');
|
detectChangesAndExpectClassName('init foo bar');
|
||||||
|
|
||||||
objExpr['foo'] = false;
|
objExpr !['foo'] = false;
|
||||||
detectChangesAndExpectClassName('init bar');
|
detectChangesAndExpectClassName('init bar');
|
||||||
|
|
||||||
getComponent().objExpr = null;
|
getComponent().objExpr = null;
|
||||||
|
@ -280,10 +280,10 @@ export function main() {
|
||||||
fixture = createTestComponent(`<div [ngClass]="objExpr" class="{{'init foo'}}"></div>`);
|
fixture = createTestComponent(`<div [ngClass]="objExpr" class="{{'init foo'}}"></div>`);
|
||||||
const objExpr = getComponent().objExpr;
|
const objExpr = getComponent().objExpr;
|
||||||
|
|
||||||
objExpr['bar'] = true;
|
objExpr !['bar'] = true;
|
||||||
detectChangesAndExpectClassName(`init foo bar`);
|
detectChangesAndExpectClassName(`init foo bar`);
|
||||||
|
|
||||||
objExpr['foo'] = false;
|
objExpr !['foo'] = false;
|
||||||
detectChangesAndExpectClassName(`init bar`);
|
detectChangesAndExpectClassName(`init bar`);
|
||||||
|
|
||||||
getComponent().objExpr = null;
|
getComponent().objExpr = null;
|
||||||
|
@ -295,10 +295,10 @@ export function main() {
|
||||||
createTestComponent(`<div [ngClass]="objExpr" class="init" [class]="'foo'"></div>`);
|
createTestComponent(`<div [ngClass]="objExpr" class="init" [class]="'foo'"></div>`);
|
||||||
const objExpr = getComponent().objExpr;
|
const objExpr = getComponent().objExpr;
|
||||||
|
|
||||||
objExpr['bar'] = true;
|
objExpr !['bar'] = true;
|
||||||
detectChangesAndExpectClassName(`init foo bar`);
|
detectChangesAndExpectClassName(`init foo bar`);
|
||||||
|
|
||||||
objExpr['foo'] = false;
|
objExpr !['foo'] = false;
|
||||||
detectChangesAndExpectClassName(`init bar`);
|
detectChangesAndExpectClassName(`init bar`);
|
||||||
|
|
||||||
getComponent().objExpr = null;
|
getComponent().objExpr = null;
|
||||||
|
@ -313,10 +313,10 @@ export function main() {
|
||||||
|
|
||||||
detectChangesAndExpectClassName('init foo baz');
|
detectChangesAndExpectClassName('init foo baz');
|
||||||
|
|
||||||
objExpr['bar'] = true;
|
objExpr !['bar'] = true;
|
||||||
detectChangesAndExpectClassName('init foo baz bar');
|
detectChangesAndExpectClassName('init foo baz bar');
|
||||||
|
|
||||||
objExpr['foo'] = false;
|
objExpr !['foo'] = false;
|
||||||
detectChangesAndExpectClassName('init baz bar');
|
detectChangesAndExpectClassName('init baz bar');
|
||||||
|
|
||||||
getComponent().condition = false;
|
getComponent().condition = false;
|
||||||
|
@ -331,7 +331,7 @@ export function main() {
|
||||||
|
|
||||||
detectChangesAndExpectClassName('init foo');
|
detectChangesAndExpectClassName('init foo');
|
||||||
|
|
||||||
cmp.objExpr['bar'] = true;
|
cmp.objExpr !['bar'] = true;
|
||||||
detectChangesAndExpectClassName('init foo bar');
|
detectChangesAndExpectClassName('init foo bar');
|
||||||
|
|
||||||
cmp.strExpr = 'baz';
|
cmp.strExpr = 'baz';
|
||||||
|
@ -350,8 +350,8 @@ class TestComponent {
|
||||||
items: any[];
|
items: any[];
|
||||||
arrExpr: string[] = ['foo'];
|
arrExpr: string[] = ['foo'];
|
||||||
setExpr: Set<string> = new Set<string>();
|
setExpr: Set<string> = new Set<string>();
|
||||||
objExpr: {[klass: string]: any} = {'foo': true, 'bar': false};
|
objExpr: {[klass: string]: any}|null = {'foo': true, 'bar': false};
|
||||||
strExpr = 'foo';
|
strExpr: string|null = 'foo';
|
||||||
|
|
||||||
constructor() { this.setExpr.add('foo'); }
|
constructor() { this.setExpr.add('foo'); }
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ export function main() {
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(fixture.nativeElement).toHaveText('foo');
|
expect(fixture.nativeElement).toHaveText('foo');
|
||||||
expect(fixture.componentInstance.cmpRef).toBeAnInstanceOf(ComponentRef);
|
expect(fixture.componentInstance.cmpRef).toBeAnInstanceOf(ComponentRef);
|
||||||
expect(fixture.componentInstance.cmpRef.instance).toBeAnInstanceOf(InjectedComponent);
|
expect(fixture.componentInstance.cmpRef !.instance).toBeAnInstanceOf(InjectedComponent);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ export function main() {
|
||||||
[{provide: TEST_TOKEN, useValue: uniqueValue}], fixture.componentRef.injector);
|
[{provide: TEST_TOKEN, useValue: uniqueValue}], fixture.componentRef.injector);
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
let cmpRef: ComponentRef<InjectedComponent> = fixture.componentInstance.cmpRef;
|
let cmpRef: ComponentRef<InjectedComponent> = fixture.componentInstance.cmpRef !;
|
||||||
expect(cmpRef).toBeAnInstanceOf(ComponentRef);
|
expect(cmpRef).toBeAnInstanceOf(ComponentRef);
|
||||||
expect(cmpRef.instance).toBeAnInstanceOf(InjectedComponent);
|
expect(cmpRef.instance).toBeAnInstanceOf(InjectedComponent);
|
||||||
expect(cmpRef.instance.testToken).toBe(uniqueValue);
|
expect(cmpRef.instance.testToken).toBe(uniqueValue);
|
||||||
|
@ -113,7 +113,7 @@ export function main() {
|
||||||
fixture.componentInstance.cmpRef = null;
|
fixture.componentInstance.cmpRef = null;
|
||||||
fixture.componentInstance.currentComponent = InjectedComponent;
|
fixture.componentInstance.currentComponent = InjectedComponent;
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
let cmpRef: ComponentRef<InjectedComponent> = fixture.componentInstance.cmpRef;
|
let cmpRef: ComponentRef<InjectedComponent> = fixture.componentInstance.cmpRef !;
|
||||||
expect(cmpRef).toBeAnInstanceOf(ComponentRef);
|
expect(cmpRef).toBeAnInstanceOf(ComponentRef);
|
||||||
expect(cmpRef.instance).toBeAnInstanceOf(InjectedComponent);
|
expect(cmpRef.instance).toBeAnInstanceOf(InjectedComponent);
|
||||||
expect(cmpRef.instance.testToken).toBeNull();
|
expect(cmpRef.instance.testToken).toBeNull();
|
||||||
|
@ -169,9 +169,9 @@ export function main() {
|
||||||
const moduleRef = fixture.componentInstance.ngComponentOutlet['_moduleRef'];
|
const moduleRef = fixture.componentInstance.ngComponentOutlet['_moduleRef'];
|
||||||
spyOn(moduleRef, 'destroy').and.callThrough();
|
spyOn(moduleRef, 'destroy').and.callThrough();
|
||||||
|
|
||||||
expect(moduleRef.destroy).not.toHaveBeenCalled();
|
expect(moduleRef !.destroy).not.toHaveBeenCalled();
|
||||||
fixture.destroy();
|
fixture.destroy();
|
||||||
expect(moduleRef.destroy).toHaveBeenCalled();
|
expect(moduleRef !.destroy).toHaveBeenCalled();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should not re-create moduleRef when it didn\'t actually change', async(() => {
|
it('should not re-create moduleRef when it didn\'t actually change', async(() => {
|
||||||
|
@ -224,13 +224,13 @@ const TEST_CMP_TEMPLATE =
|
||||||
`<ng-template *ngComponentOutlet="currentComponent; injector: injector; content: projectables; ngModuleFactory: module;"></ng-template>`;
|
`<ng-template *ngComponentOutlet="currentComponent; injector: injector; content: projectables; ngModuleFactory: module;"></ng-template>`;
|
||||||
@Component({selector: 'test-cmp', template: TEST_CMP_TEMPLATE})
|
@Component({selector: 'test-cmp', template: TEST_CMP_TEMPLATE})
|
||||||
class TestComponent {
|
class TestComponent {
|
||||||
currentComponent: Type<any>;
|
currentComponent: Type<any>|null;
|
||||||
injector: Injector;
|
injector: Injector;
|
||||||
projectables: any[][];
|
projectables: any[][];
|
||||||
module: NgModuleFactory<any>;
|
module: NgModuleFactory<any>;
|
||||||
|
|
||||||
get cmpRef(): ComponentRef<any> { return this.ngComponentOutlet['_componentRef']; }
|
get cmpRef(): ComponentRef<any>|null { return this.ngComponentOutlet['_componentRef']; }
|
||||||
set cmpRef(value: ComponentRef<any>) { this.ngComponentOutlet['_componentRef'] = value; }
|
set cmpRef(value: ComponentRef<any>|null) { this.ngComponentOutlet['_componentRef'] = value; }
|
||||||
|
|
||||||
@ViewChildren(TemplateRef) tplRefs: QueryList<TemplateRef<any>>;
|
@ViewChildren(TemplateRef) tplRefs: QueryList<TemplateRef<any>>;
|
||||||
@ViewChild(NgComponentOutlet) ngComponentOutlet: NgComponentOutlet;
|
@ViewChild(NgComponentOutlet) ngComponentOutlet: NgComponentOutlet;
|
||||||
|
|
|
@ -25,7 +25,7 @@ export function main() {
|
||||||
expect(fixture.nativeElement).toHaveText(text);
|
expect(fixture.nativeElement).toHaveText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEach(() => { fixture = null; });
|
afterEach(() => { fixture = null as any; });
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
|
@ -103,7 +103,7 @@ export function main() {
|
||||||
|
|
||||||
detectChangesAndExpectText('1;2;');
|
detectChangesAndExpectText('1;2;');
|
||||||
|
|
||||||
getComponent().items = null;
|
getComponent().items = null !;
|
||||||
detectChangesAndExpectText('');
|
detectChangesAndExpectText('');
|
||||||
|
|
||||||
getComponent().items = [1, 2, 3];
|
getComponent().items = [1, 2, 3];
|
||||||
|
|
|
@ -19,7 +19,7 @@ export function main() {
|
||||||
|
|
||||||
function getComponent(): TestComponent { return fixture.componentInstance; }
|
function getComponent(): TestComponent { return fixture.componentInstance; }
|
||||||
|
|
||||||
afterEach(() => { fixture = null; });
|
afterEach(() => { fixture = null !; });
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
|
|
|
@ -22,7 +22,7 @@ export function main() {
|
||||||
expect(fixture.nativeElement).toHaveText(text);
|
expect(fixture.nativeElement).toHaveText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEach(() => { fixture = null; });
|
afterEach(() => { fixture = null !; });
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
|
@ -153,7 +153,7 @@ class TestLocalization extends NgLocalization {
|
||||||
|
|
||||||
@Component({selector: 'test-cmp', template: ''})
|
@Component({selector: 'test-cmp', template: ''})
|
||||||
class TestComponent {
|
class TestComponent {
|
||||||
switchValue: number = null;
|
switchValue: number|null = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createTestComponent(template: string): ComponentFixture<TestComponent> {
|
function createTestComponent(template: string): ComponentFixture<TestComponent> {
|
||||||
|
|
|
@ -20,7 +20,7 @@ export function main() {
|
||||||
return expect(fixture.debugElement.children[0].nativeElement);
|
return expect(fixture.debugElement.children[0].nativeElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEach(() => { fixture = null; });
|
afterEach(() => { fixture = null !; });
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({declarations: [TestComponent], imports: [CommonModule]});
|
TestBed.configureTestingModule({declarations: [TestComponent], imports: [CommonModule]});
|
||||||
|
|
|
@ -22,7 +22,7 @@ export function main() {
|
||||||
expect(fixture.nativeElement).toHaveText(text);
|
expect(fixture.nativeElement).toHaveText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEach(() => { fixture = null; });
|
afterEach(() => { fixture = null !; });
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
|
|
|
@ -22,7 +22,7 @@ export function main() {
|
||||||
expect(fixture.debugElement.nativeElement).toHaveText(text);
|
expect(fixture.debugElement.nativeElement).toHaveText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
afterEach(() => { fixture = null; });
|
afterEach(() => { fixture = null as any; });
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
|
@ -61,7 +61,7 @@ export function main() {
|
||||||
`<ng-container [ngTemplateOutlet]="currentTplRef"></ng-container>`;
|
`<ng-container [ngTemplateOutlet]="currentTplRef"></ng-container>`;
|
||||||
fixture = createTestComponent(template);
|
fixture = createTestComponent(template);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const refs = fixture.debugElement.children[0].references['refs'];
|
const refs = fixture.debugElement.children[0].references !['refs'];
|
||||||
|
|
||||||
setTplRef(refs.tplRefs.first);
|
setTplRef(refs.tplRefs.first);
|
||||||
detectChangesAndExpectText('foo');
|
detectChangesAndExpectText('foo');
|
||||||
|
@ -77,7 +77,7 @@ export function main() {
|
||||||
fixture = createTestComponent(template);
|
fixture = createTestComponent(template);
|
||||||
|
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
const refs = fixture.debugElement.children[0].references['refs'];
|
const refs = fixture.debugElement.children[0].references !['refs'];
|
||||||
|
|
||||||
setTplRef(refs.tplRefs.first);
|
setTplRef(refs.tplRefs.first);
|
||||||
detectChangesAndExpectText('foo');
|
detectChangesAndExpectText('foo');
|
||||||
|
|
|
@ -201,14 +201,14 @@ export function main() {
|
||||||
|
|
||||||
describe('null', () => {
|
describe('null', () => {
|
||||||
it('should return null when given null', () => {
|
it('should return null when given null', () => {
|
||||||
const pipe = new AsyncPipe(null);
|
const pipe = new AsyncPipe(null as any);
|
||||||
expect(pipe.transform(null)).toEqual(null);
|
expect(pipe.transform(null)).toEqual(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('other types', () => {
|
describe('other types', () => {
|
||||||
it('should throw when given an invalid object', () => {
|
it('should throw when given an invalid object', () => {
|
||||||
const pipe = new AsyncPipe(null);
|
const pipe = new AsyncPipe(null as any);
|
||||||
expect(() => pipe.transform(<any>'some bogus object')).toThrowError();
|
expect(() => pipe.transform(<any>'some bogus object')).toThrowError();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -197,7 +197,7 @@ export function main() {
|
||||||
() => expect(pipe.transform('2017-01-20T19:00:00+0000')).toEqual('Jan 20, 2017'));
|
() => expect(pipe.transform('2017-01-20T19:00:00+0000')).toEqual('Jan 20, 2017'));
|
||||||
|
|
||||||
it('should remove bidi control characters',
|
it('should remove bidi control characters',
|
||||||
() => expect(pipe.transform(date, 'MM/dd/yyyy').length).toEqual(10));
|
() => expect(pipe.transform(date, 'MM/dd/yyyy') !.length).toEqual(10));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ export function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should use "" if value is undefined', () => {
|
it('should use "" if value is undefined', () => {
|
||||||
const val = pipe.transform(void(0), mapping);
|
const val = pipe.transform(void(0) as any, mapping);
|
||||||
expect(val).toEqual('');
|
expect(val).toEqual('');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -51,8 +51,8 @@ export function main() {
|
||||||
|
|
||||||
describe('transform', () => {
|
describe('transform', () => {
|
||||||
it('should return correct value for numbers', () => {
|
it('should return correct value for numbers', () => {
|
||||||
expect(normalize(pipe.transform(1.23))).toEqual('123%');
|
expect(normalize(pipe.transform(1.23) !)).toEqual('123%');
|
||||||
expect(normalize(pipe.transform(1.2, '.2'))).toEqual('120.00%');
|
expect(normalize(pipe.transform(1.2, '.2') !)).toEqual('120.00%');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not support other objects',
|
it('should not support other objects',
|
||||||
|
@ -69,12 +69,12 @@ export function main() {
|
||||||
it('should return correct value for numbers', () => {
|
it('should return correct value for numbers', () => {
|
||||||
// In old Chrome, default formatiing for USD is different
|
// In old Chrome, default formatiing for USD is different
|
||||||
if (browserDetection.isOldChrome) {
|
if (browserDetection.isOldChrome) {
|
||||||
expect(normalize(pipe.transform(123))).toEqual('USD123');
|
expect(normalize(pipe.transform(123) !)).toEqual('USD123');
|
||||||
} else {
|
} else {
|
||||||
expect(normalize(pipe.transform(123))).toEqual('USD123.00');
|
expect(normalize(pipe.transform(123) !)).toEqual('USD123.00');
|
||||||
}
|
}
|
||||||
expect(normalize(pipe.transform(12, 'EUR', false, '.1'))).toEqual('EUR12.0');
|
expect(normalize(pipe.transform(12, 'EUR', false, '.1') !)).toEqual('EUR12.0');
|
||||||
expect(normalize(pipe.transform(5.1234, 'USD', false, '.0-3'))).toEqual('USD5.123');
|
expect(normalize(pipe.transform(5.1234, 'USD', false, '.0-3') !)).toEqual('USD5.123');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not support other objects',
|
it('should not support other objects',
|
||||||
|
|
|
@ -25,7 +25,7 @@ export class SpyLocation implements Location {
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_baseHref: string = '';
|
_baseHref: string = '';
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_platformStrategy: LocationStrategy = null;
|
_platformStrategy: LocationStrategy = null !;
|
||||||
|
|
||||||
setInitialPath(url: string) { this._history[this._historyIndex].path = url; }
|
setInitialPath(url: string) { this._history[this._historyIndex].path = url; }
|
||||||
|
|
||||||
|
@ -106,12 +106,12 @@ export class SpyLocation implements Location {
|
||||||
}
|
}
|
||||||
|
|
||||||
subscribe(
|
subscribe(
|
||||||
onNext: (value: any) => void, onThrow: (error: any) => void = null,
|
onNext: (value: any) => void, onThrow?: ((error: any) => void)|null,
|
||||||
onReturn: () => void = null): Object {
|
onReturn?: (() => void)|null): Object {
|
||||||
return this._subject.subscribe({next: onNext, error: onThrow, complete: onReturn});
|
return this._subject.subscribe({next: onNext, error: onThrow, complete: onReturn});
|
||||||
}
|
}
|
||||||
|
|
||||||
normalize(url: string): string { return null; }
|
normalize(url: string): string { return null !; }
|
||||||
}
|
}
|
||||||
|
|
||||||
class LocationState {
|
class LocationState {
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
"declaration": true,
|
"declaration": true,
|
||||||
"stripInternal": true,
|
"stripInternal": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
"module": "es2015",
|
"module": "es2015",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"outDir": "../../dist/packages/common",
|
"outDir": "../../dist/packages/common",
|
||||||
|
|
|
@ -5,9 +5,10 @@ export declare const APP_BASE_HREF: InjectionToken<string>;
|
||||||
export declare class AsyncPipe implements OnDestroy, PipeTransform {
|
export declare class AsyncPipe implements OnDestroy, PipeTransform {
|
||||||
constructor(_ref: ChangeDetectorRef);
|
constructor(_ref: ChangeDetectorRef);
|
||||||
ngOnDestroy(): void;
|
ngOnDestroy(): void;
|
||||||
transform<T>(obj: EventEmitter<T>): T | null;
|
|
||||||
transform<T>(obj: Promise<T>): T | null;
|
transform<T>(obj: Promise<T>): T | null;
|
||||||
transform<T>(obj: Observable<T>): T | null;
|
transform<T>(obj: Observable<T>): T | null;
|
||||||
|
transform<T>(obj: undefined): undefined;
|
||||||
|
transform<T>(obj: null): null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
|
@ -17,19 +18,19 @@ export declare class CommonModule {
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class CurrencyPipe implements PipeTransform {
|
export declare class CurrencyPipe implements PipeTransform {
|
||||||
constructor(_locale: string);
|
constructor(_locale: string);
|
||||||
transform(value: any, currencyCode?: string, symbolDisplay?: boolean, digits?: string): string;
|
transform(value: any, currencyCode?: string, symbolDisplay?: boolean, digits?: string): string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class DatePipe implements PipeTransform {
|
export declare class DatePipe implements PipeTransform {
|
||||||
constructor(_locale: string);
|
constructor(_locale: string);
|
||||||
transform(value: any, pattern?: string): string;
|
transform(value: any, pattern?: string): string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class DecimalPipe implements PipeTransform {
|
export declare class DecimalPipe implements PipeTransform {
|
||||||
constructor(_locale: string);
|
constructor(_locale: string);
|
||||||
transform(value: any, digits?: string): string;
|
transform(value: any, digits?: string): string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
|
@ -55,7 +56,7 @@ export declare class I18nPluralPipe implements PipeTransform {
|
||||||
|
|
||||||
/** @experimental */
|
/** @experimental */
|
||||||
export declare class I18nSelectPipe implements PipeTransform {
|
export declare class I18nSelectPipe implements PipeTransform {
|
||||||
transform(value: string, mapping: {
|
transform(value: string | null | undefined, mapping: {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
}): string;
|
}): string;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +89,7 @@ export declare class Location {
|
||||||
path(includeHash?: boolean): string;
|
path(includeHash?: boolean): string;
|
||||||
prepareExternalUrl(url: string): string;
|
prepareExternalUrl(url: string): string;
|
||||||
replaceState(path: string, query?: string): void;
|
replaceState(path: string, query?: string): void;
|
||||||
subscribe(onNext: (value: PopStateEvent) => void, onThrow?: (exception: any) => void, onReturn?: () => void): Object;
|
subscribe(onNext: (value: PopStateEvent) => void, onThrow?: ((exception: any) => void) | null, onReturn?: (() => void) | null): Object;
|
||||||
static joinWithSlash(start: string, end: string): string;
|
static joinWithSlash(start: string, end: string): string;
|
||||||
static normalizeQueryParams(params: string): string;
|
static normalizeQueryParams(params: string): string;
|
||||||
static stripTrailingSlash(url: string): string;
|
static stripTrailingSlash(url: string): string;
|
||||||
|
@ -261,14 +262,14 @@ export declare class PathLocationStrategy extends LocationStrategy {
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare class PercentPipe implements PipeTransform {
|
export declare class PercentPipe implements PipeTransform {
|
||||||
constructor(_locale: string);
|
constructor(_locale: string);
|
||||||
transform(value: any, digits?: string): string;
|
transform(value: any, digits?: string): string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @stable */
|
/** @stable */
|
||||||
export declare abstract class PlatformLocation {
|
export declare abstract class PlatformLocation {
|
||||||
readonly hash: string;
|
readonly abstract hash: string;
|
||||||
readonly pathname: string;
|
readonly abstract pathname: string;
|
||||||
readonly search: string;
|
readonly abstract search: string;
|
||||||
abstract back(): void;
|
abstract back(): void;
|
||||||
abstract forward(): void;
|
abstract forward(): void;
|
||||||
abstract getBaseHrefFromDOM(): string;
|
abstract getBaseHrefFromDOM(): string;
|
||||||
|
|
|
@ -31,5 +31,5 @@ export declare class SpyLocation implements Location {
|
||||||
setInitialPath(url: string): void;
|
setInitialPath(url: string): void;
|
||||||
simulateHashChange(pathname: string): void;
|
simulateHashChange(pathname: string): void;
|
||||||
simulateUrlPop(pathname: string): void;
|
simulateUrlPop(pathname: string): void;
|
||||||
subscribe(onNext: (value: any) => void, onThrow?: (error: any) => void, onReturn?: () => void): Object;
|
subscribe(onNext: (value: any) => void, onThrow?: ((error: any) => void) | null, onReturn?: (() => void) | null): Object;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue