Function identity

Returns the value passed in, preserving its type.

identity(1) // => 1
identity('a') // => 'a'
identity(true) // => true
  • Type Parameters

    • T

      The type of the value to return.

    Parameters

    • x: T

      The value to return.

    Returns T

    The value passed in.