From a9ec5e7fe0e9985a1c97b279af71e2bd9101039a Mon Sep 17 00:00:00 2001 From: Mitya Kononchuk Date: Tue, 14 Nov 2017 17:54:06 +0100 Subject: [PATCH] Switch to strict null checks --- types/jasmine/jasmine-tests.ts | 14 +++++++------- types/jasmine/tsconfig.json | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/types/jasmine/jasmine-tests.ts b/types/jasmine/jasmine-tests.ts index cec0d557a7..050a20db7a 100644 --- a/types/jasmine/jasmine-tests.ts +++ b/types/jasmine/jasmine-tests.ts @@ -33,7 +33,7 @@ describe("Included matchers:", () => { var b = a; expect(a).toBe(b); - expect(a).not.toBe(null); + expect(a).not.toBe(24); }); describe("The 'toEqual' matcher", () => { @@ -83,7 +83,7 @@ describe("Included matchers:", () => { }); it("The 'toBeNull' matcher compares against null", () => { - var a: string = null; + var a: string | null = null; var foo = "foo"; expect(null).toBeNull(); @@ -92,14 +92,14 @@ describe("Included matchers:", () => { }); it("The 'toBeTruthy' matcher is for boolean casting testing", () => { - var a: string, foo = "foo"; + var a: string | undefined, foo = "foo"; expect(foo).toBeTruthy(); expect(a).not.toBeTruthy(); }); it("The 'toBeFalsy' matcher is for boolean casting testing", () => { - var a: string, foo = "foo"; + var a: string | undefined, foo = "foo"; expect(a).toBeFalsy(); expect(foo).not.toBeFalsy(); @@ -1026,19 +1026,19 @@ var myReporter: jasmine.CustomReporter = { specDone: (result: jasmine.CustomReporterResult) => { console.log("Spec: " + result.description + " was " + result.status); //tslint:disable-next-line:prefer-for-of - for (var i = 0; i < result.failedExpectations.length; i++) { + for (var i = 0; result.failedExpectations && i < result.failedExpectations.length; i++) { console.log("Failure: " + result.failedExpectations[i].message); console.log("Actual: " + result.failedExpectations[i].actual); console.log("Expected: " + result.failedExpectations[i].expected); console.log(result.failedExpectations[i].stack); } - console.log(result.passedExpectations.length); + console.log(result.passedExpectations && result.passedExpectations.length); }, suiteDone: (result: jasmine.CustomReporterResult) => { console.log('Suite: ' + result.description + ' was ' + result.status); //tslint:disable-next-line:prefer-for-of - for (var i = 0; i < result.failedExpectations.length; i++) { + for (var i = 0; result.failedExpectations && i < result.failedExpectations.length; i++) { console.log('AfterAll ' + result.failedExpectations[i].message); console.log(result.failedExpectations[i].stack); } diff --git a/types/jasmine/tsconfig.json b/types/jasmine/tsconfig.json index 3af72e4d8b..55b83c6d3a 100644 --- a/types/jasmine/tsconfig.json +++ b/types/jasmine/tsconfig.json @@ -11,7 +11,7 @@ ], "noImplicitAny": true, "noImplicitThis": false, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": false, "baseUrl": "../", "typeRoots": [ @@ -21,4 +21,4 @@ "noEmit": true, "forceConsistentCasingInFileNames": true } -} \ No newline at end of file +}