Skip to main content

isPrimitive

Callable

  • isPrimitive(x: unknown): x is boolean | PropertyKey

  • Checks if x is a primitive.

    Example

    isPrimitive(1234)
    // => true

    isPrimitive(12.34)
    // => true

    isPrimitive("foobar")
    // => true

    isPrimitive({})
    // => false
    @deprecated

    Hard to find a use case for this function.


    Parameters

    • x: unknown

      The value to check.

    Returns x is boolean | PropertyKey

    true if x is a primitive, false otherwise.