@yookue/ts-lang-utils
    Preparing search index...

    Function isTypeof

    • Returns whether each element in the given array is the expected type

      Parameters

      • Optionalarray: null | any[] | readonly any[]

        the array to check

      • Optionaltype: string

        the expected element type

      • relaxed: boolean = false

        treat null as string or object

      Returns boolean

      whether each element in the given array is the expected type

      David Hsing

      isTypeof(['foo', 'bar'], 'string');    // true
      isTypeof(['foo', 'bar', null], 'string', true); // true