From 08374625aac34f80088814ac0db0926447b3c134 Mon Sep 17 00:00:00 2001 From: beckend Date: Tue, 11 Oct 2016 12:16:03 +0200 Subject: [PATCH] fix optional callback --- jest/index.d.ts | 4 ++-- jest/jest-tests.ts | 9 +++++++++ jest/tsconfig.json | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/jest/index.d.ts b/jest/index.d.ts index d0660193f6..fbf0180950 100644 --- a/jest/index.d.ts +++ b/jest/index.d.ts @@ -87,7 +87,7 @@ declare namespace jest { } interface ProvidesCallback { - (cb?: DoneCallback): any; + (cb: DoneCallback): any; } interface Lifecycle { @@ -95,7 +95,7 @@ declare namespace jest { } interface It { - (name: string, fn: ProvidesCallback): void; + (name: string, fn?: ProvidesCallback): void; only: It; skip: It; } diff --git a/jest/jest-tests.ts b/jest/jest-tests.ts index e774ad1fb5..29617056cd 100644 --- a/jest/jest-tests.ts +++ b/jest/jest-tests.ts @@ -351,3 +351,12 @@ describe('genMockFromModule', function () { }); }); }); + +/** + * Pass strictNullChecks + */ +describe('strictNullChecks', function () { + it('does not complain when using done callback', (done) => { + done(); + }) +}); diff --git a/jest/tsconfig.json b/jest/tsconfig.json index 0ad43c6b19..da1e33c024 100644 --- a/jest/tsconfig.json +++ b/jest/tsconfig.json @@ -3,7 +3,7 @@ "module": "commonjs", "target": "es6", "noImplicitAny": true, - "strictNullChecks": false, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../"