Type guard that checks if a value is not a symbol.
Type Narrowing Behavior:
symbol
true
The type of the input value
The value to check
true if u is not a symbol, false otherwise. When true, TypeScript excludes symbol from the type.
u
false
const id = Symbol('id');const tokens: unknown[] = [id, 'shared'];const nonSymbols = tokens.filter(isNotSymbol);assert.deepStrictEqual(nonSymbols, ['shared']); Copy
const id = Symbol('id');const tokens: unknown[] = [id, 'shared'];const nonSymbols = tokens.filter(isNotSymbol);assert.deepStrictEqual(nonSymbols, ['shared']);
Type guard that checks if a value is not a symbol.
Type Narrowing Behavior:
symbol
from the input type whentrue