mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
[jquery] Revert isEmptyObject() to returning boolean.
While the type guard does narrow a value's type to an empty object, the interesting case is when the type is not an empty object. TypeScript narrows the type to never in that case which makes the type guard not very useful.
This commit is contained in:
Vendored
+1
-1
@@ -587,7 +587,7 @@ interface JQueryStatic<TElement extends Node = HTMLElement> {
|
||||
* @see {@link https://api.jquery.com/jQuery.isEmptyObject/}
|
||||
* @since 1.4
|
||||
*/
|
||||
isEmptyObject(obj: any): obj is {};
|
||||
isEmptyObject(obj: any): boolean;
|
||||
/**
|
||||
* Determine if the argument passed is a JavaScript function object.
|
||||
*
|
||||
|
||||
@@ -627,12 +627,8 @@ function JQueryStatic() {
|
||||
}
|
||||
|
||||
function isEmptyObject() {
|
||||
function type_guard(obj: object) {
|
||||
if ($.isEmptyObject(obj)) {
|
||||
// $ExpectType {}
|
||||
obj;
|
||||
}
|
||||
}
|
||||
// $ExpectType boolean
|
||||
$.isEmptyObject({});
|
||||
}
|
||||
|
||||
function isFunction() {
|
||||
|
||||
Reference in New Issue
Block a user