diff --git a/src/utils/is-empty.ts b/src/utils/is-empty.ts index 1c5ed36..0ea8fed 100644 --- a/src/utils/is-empty.ts +++ b/src/utils/is-empty.ts @@ -4,6 +4,27 @@ import { isArguments } from './is-arguments'; import { isUndefined } from './is-undefined'; import { isSet } from './is-set'; + +interface IEmptyArguments extends IArguments { + length: 0; +} + +interface IEmptyObj { + [s: string]: never; +} + +type IEmptyTypes = ( + null | + undefined | + boolean | + number | + never[] | + '' | + IEmptyArguments | + Set | + IEmptyObj +); + /** * Checks if `o` is an empty object. An object is "empty" if it: * @@ -13,7 +34,7 @@ import { isSet } from './is-set'; * * @returns `true` if `o` is empty */ -export function isEmpty(o: any): boolean { +export function isEmpty(o: any): o is IEmptyTypes { if (o === null || isUndefined(o)) { return true; }