From ef2b8b0884a1ed2dc3c74c1bc34f6e0585bbab15 Mon Sep 17 00:00:00 2001 From: Alice Pote Date: Mon, 25 Apr 2022 11:08:16 -0400 Subject: [PATCH] fix some typings on those `is${TypeName}` functions --- src/utils/helpers.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index 031d272681c..a051897a1d1 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -81,13 +81,13 @@ export const pluck = (obj: { [key: string]: any }, keys: string[]) => { }; export const isBoolean = (v: any): v is boolean => typeof v === 'boolean'; -export const isDefined = (v: any) => v !== null && v !== undefined; +export const isDefined = (v: any): v is NonNullable => v !== null && v !== undefined; export const isUndefined = (v: any): v is null | undefined => v === null || v === undefined; export const isFunction = (v: any): v is Function => typeof v === 'function'; -export const isNumber = (v: any): v is boolean => typeof v === 'number'; +export const isNumber = (v: any): v is number => typeof v === 'number'; export const isObject = (val: Object): val is Object => val != null && typeof val === 'object' && Array.isArray(val) === false; export const isString = (v: any): v is string => typeof v === 'string'; -export const isIterable = (v: any): v is Iterable => isDefined(v) && isFunction(v[Symbol.iterator]); +export const isIterable = (v: any): v is Iterable => isDefined(v) && isFunction(v[Symbol.iterator]); export const isPromise = (v: any): v is Promise => !!v && (typeof v === 'object' || typeof v === 'function') && typeof v.then === 'function';