UnaryOperator<T>: Function<T, T>

A function that takes a value of type T and returns a value of type T. This function represents a unary operator, which is a function that takes a single value and returns a value of the same type.

Type Parameters

  • T

    The type of the input to the function

Example: A unary operator can be a function that represents unary operations such as negation, increment, decrement, etc.

const negate: UnaryOperator<number> = (a) => -a;
const increment: UnaryOperator<number> = (a) => a + 1;
const decrement: UnaryOperator<number> = (a) => a - 1;

Generated using TypeDoc