fix(common): weaken AsyncPipe transform signature (#22169)

The AsyncPipe type signature was changed to allow
deferred creation of promises and observalbes that
is supported by the implementation by allowing
`Promise<T>|null|undefined` and by allowing
`Observable<T>|null|undefined`.

PR Close #22169
This commit is contained in:
Chuck Jazdzewski
2018-02-12 09:06:17 -08:00
committed by Miško Hevery
parent b333919722
commit be59c3a98c
3 changed files with 38 additions and 6 deletions

View File

@ -620,12 +620,12 @@ describe('ng type checker', () => {
});
});
describe('regressions ', () => {
describe('core', () => {
const a = (files: MockFiles, options: ng.AngularCompilerOptions = {}) => {
accept(files, {fullTemplateTypeCheck: true, ...options});
};
// #19905
// Regression #19905
it('should accept an event binding', () => {
a({
'src/app.component.ts': '',
@ -655,6 +655,38 @@ describe('ng type checker', () => {
});
});
describe('common', () => {
const a = (files: MockFiles, options: ng.AngularCompilerOptions = {}) => {
accept(files, {fullTemplateTypeCheck: true, ...options});
};
// Regression #19905
it('should accept a |undefined or |null parameter for async_pipe', () => {
a({
'src/app.component.ts': '',
'src/lib.ts': '',
'src/app.module.ts': `
import {NgModule, Component} from '@angular/core';
import {CommonModule} from '@angular/common';
@Component({
selector: 'comp',
template: '<div>{{ name | async}}</div>'
})
export class MainComp {
name: Promise<string>|undefined;
}
@NgModule({
declarations: [MainComp],
imports: [CommonModule]
})
export class MainModule {}`
});
});
});
describe('with modified quickstart (fullTemplateTypeCheck: false)', () => {
addTests({fullTemplateTypeCheck: false});
});