mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 14:59:37 +08:00
[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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user