fix(core): Update types for TypeScript nullability support (#15472)

This commit is contained in:
Miško Hevery
2017-03-29 09:34:45 -07:00
committed by Victor Berchet
parent 331b9f6425
commit 910c0d9ee7
84 changed files with 1287 additions and 1260 deletions

View File

@ -468,12 +468,12 @@ function commonTests() {
it('should call onUnstable and onMicrotaskEmpty when an inner microtask is scheduled from outside angular',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
let resolve: (result: string) => void;
let promise: Promise<string>;
let resolve: (result: string | null) => void;
let promise: Promise<string|null>;
macroTask(() => {
NgZone.assertNotInAngularZone();
promise = new Promise(res => { resolve = res; });
promise = new Promise<string|null>(res => { resolve = res; });
});
runNgZoneNoLog(() => {
@ -637,15 +637,15 @@ function commonTests() {
it('should call onUnstable and onMicrotaskEmpty before and after each turn, respectively',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
let aResolve: (result: string) => void;
let aResolve: (result: string | null) => void;
let aPromise: Promise<string>;
let bResolve: (result: string) => void;
let bResolve: (result: string | null) => void;
let bPromise: Promise<string>;
runNgZoneNoLog(() => {
macroTask(() => {
aPromise = new Promise(res => { aResolve = res; });
bPromise = new Promise(res => { bResolve = res; });
aPromise = new Promise<string|null>(res => { aResolve = res; });
bPromise = new Promise<string|null>(res => { bResolve = res; });
aPromise.then(_log.fn('a then'));
bPromise.then(_log.fn('b then'));
_log.add('run start');
@ -763,7 +763,7 @@ function commonTests() {
}));
it('should fakeAsync even if the NgZone was created outside.', fakeAsync(() => {
let result: string = null;
let result: string = null !;
// try to escape the current fakeAsync zone by using NgZone which was created outside.
ngZone.run(() => {
Promise.resolve('works').then((v) => result = v);
@ -776,7 +776,7 @@ function commonTests() {
let asyncResult: string;
const waitLongerThenTestFrameworkAsyncTimeout = 5;
beforeEach(() => { asyncResult = null; });
beforeEach(() => { asyncResult = null !; });
it('should async even if the NgZone was created outside.', async(() => {
// try to escape the current async zone by using NgZone which was created outside.