Function is

  • Tests a value type.

    Tests a parametric value type and returns whether it's following the type T or not. If the parametric value is matched with the type T, true value would be returned. Otherwise, the parametric value is not following the type T, false value would be returned.

    If what you want is not just knowing whether the parametric value is following the type T or not, but throwing an exception with detailed reason, you can choose assert function instead. Also, if you want to know all the errors with detailed reasons, validate function would be useful.

    On the other and, if you don't want to allow any superfluous property that is not enrolled to the type T, you can use equals function instead.

    Type Parameters

    • T

      Type of the input value

    Parameters

    • input: T

      A value to be tested

    Returns input is T

    Whether the parametric value is following the type T or not

    Jeongho Nam - https://github.com/samchon

  • Tests a value type.

    Tests a parametric value type and returns whether it's following the type T or not. If the parametric value is matched with the type T, true value would be returned. Otherwise, the parametric value is not following the type T, false value would be returned.

    If what you want is not just knowing whether the parametric value is following the type T or not, but throwing an exception with detailed reason, you can choose assert function instead. Also, if you want to know all the errors with detailed reasons, validate function would be useful.

    On the other and, if you don't want to allow any superfluous property that is not enrolled to the type T, you can use equals function instead.

    Type Parameters

    • T

      Type of the input value

    Parameters

    • input: unknown

      A value to be tested

    Returns input is T

    Whether the parametric value is following the type T or not

    Jeongho Nam - https://github.com/samchon