From ec2158f2d6f34297a2dc52b93537cd089cc68285 Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Tue, 18 Jul 2017 09:22:02 -0400 Subject: [PATCH] [jquery] Add tests for type of a type guard in the not case. Note that isPlainObject() fails the not case in the same manner that isEmptyObject() does. This might warrant changing it to return a boolean. However, unlike isEmptyObject(), isPlainObject() can be useful when the object is a plain object. --- types/jquery/jquery-tests.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 0485d05351..4bbe9c553e 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -622,6 +622,9 @@ function JQueryStatic() { if ($.isArray(obj)) { // $ExpectType any[] obj; + } else { + // $ExpectType object + obj; } } } @@ -636,6 +639,9 @@ function JQueryStatic() { if ($.isFunction(obj)) { // $ExpectType Function obj; + } else { + // $ExpectType object + obj; } } } @@ -645,6 +651,9 @@ function JQueryStatic() { if ($.isNumeric(obj)) { // $ExpectType (true & number) | (false & number) obj; + } else { + // $ExpectType boolean + obj; } } } @@ -663,6 +672,9 @@ function JQueryStatic() { if ($.isWindow(obj)) { // $ExpectType Window obj; + } else { + // $ExpectType object + obj; } } }