Preparing search index...
    • Checks if a value is an array of objects with specific type structure

      Type Parameters

      • T

      Parameters

      • val: unknown

        The value to check

      • keys: (keyof T)[]

        Array of required keys for the type T

      Returns boolean

      True if the value is an array of objects matching type T

      interface User { name: string; age: number; }
      isArrayOfType<User>(users, ["name", "age"]) // true if all objects have name and age