core-utils
    Preparing search index...
    • Type guard that narrows an array to a non-empty tuple type. After this check, TypeScript knows arr[0] is defined.

      Type Parameters

      • T

      Parameters

      • array: T[]

      Returns array is [T, ...T[]]

      if (!isNonEmptyArray(items)) {
      return;
      }
      // items[0] is now typed as T (not T | undefined)
      const first = items[0];