type Constructor = new (...args: unknown[]) => T; /* Check whether array is of the specified type */ export const isArrayOfType = ( arr: unknown[] | unknown, type: Constructor | string ): arr is T[] => { return ( Array.isArray(arr) && arr.every((item): item is T => { if (typeof type === "string") { return typeof item === type; } else { return item instanceof type; } }) ); };