ts-data-forge
    Preparing search index...

    Function isNotString

    • Type guard that checks if a value is not a string.

      Type Narrowing Behavior:

      • Excludes string from the input type when true
      • Preserves all other types in the union

      Type Parameters

      • T

        The type of the input value

      Parameters

      • u: T

        The value to check

      Returns u is RelaxedExclude<T, string>

      true if u is not a string, false otherwise. When true, TypeScript excludes string from the type.

      const values: unknown[] = ['Ada', 42, 'Lovelace'];

      const nonStrings = values.filter(isNotString);

      assert.deepStrictEqual(nonStrings, [42]);