Function isPropertyKey

  • Checks if the given value is a valid PropertyKey of an object (string, symbol, or number).

    Example

    isPropertyKey("Vangware"); // true
    isPropertyKey(1); // true
    isPropertyKey(Symbol("Vangware")); // true
    isPropertyKey({}); // false

    Parameters

    • input: unknown

      Value to check.

    Returns input is PropertyKey

    true if the given value is a valid PropertyKey of an object, false otherwise.