@jossmac/lil-libs
    Preparing search index...

    Function isDefined

    • Type guard for filtering out null and undefined without losing type precision.

      • T
      • value: T | null | undefined

        Value that may be null or undefined.

      true when value is neither null nor undefined; narrows the type to exclude both.

      const bad = [1, null, 2, undefined, 3].filter(Boolean);
      // ^? (number | null | undefined)[]

      const good = [1, null, 2, undefined, 3].filter(isDefined);
      // ^? number[]