Type guard that checks if a value is not a string.
Type Narrowing Behavior:
string
true
The type of the input value
The value to check
true if u is not a string, false otherwise. When true, TypeScript excludes string from the type.
u
false
const values: unknown[] = ['Ada', 42, 'Lovelace'];const nonStrings = values.filter(isNotString);assert.deepStrictEqual(nonStrings, [42]); Copy
const values: unknown[] = ['Ada', 42, 'Lovelace'];const nonStrings = values.filter(isNotString);assert.deepStrictEqual(nonStrings, [42]);
Type guard that checks if a value is not a string.
Type Narrowing Behavior:
string
from the input type whentrue