Skip to content

Commit

Permalink
fix some typings on those is${TypeName} functions
Browse files Browse the repository at this point in the history
  • Loading branch information
alicewriteswrongs committed Apr 25, 2022
1 parent d8a4748 commit ef2b8b0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof v> => 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<any> => isDefined(v) && isFunction(v[Symbol.iterator]);
export const isIterable = <T>(v: any): v is Iterable<T> => isDefined(v) && isFunction(v[Symbol.iterator]);
export const isPromise = <T = any>(v: any): v is Promise<T> =>
!!v && (typeof v === 'object' || typeof v === 'function') && typeof v.then === 'function';

0 comments on commit ef2b8b0

Please sign in to comment.