Function assertClone

  • Clone a data with type assertion.

    Clones an instance following type T, with type assertion. If the target input value or its member variable contains a class instance having methods, those methods would not be cloned.

    In such reason, when input value is not matched with the type T, it throws an TypeGuardError or custom error generated by errorFactory. Otherwise, there's no problem on the input value, cloned data would be returned.

    Type Parameters

    • T

      Type of the input value

    Parameters

    • input: T

      A value to be cloned

    • OptionalerrorFactory: ((props: TypeGuardError.IProps) => Error)

      Custom error factory. Default is TypeGuardError

    Returns Resolved<T>

    Cloned data

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

  • Clone a data with type assertion.

    Clones an instance following type T, with type assertion. If the target input value or its member variable contains a class instance having methods, those methods would not be cloned.

    In such reason, when input value is not matched with the type T, it throws an TypeGuardError or custom error generated by errorFactory. Otherwise, there's no problem on the input value, cloned data would be returned.

    Type Parameters

    • T

      Type of the input value

    Parameters

    • input: unknown

      A value to be cloned

    • OptionalerrorFactory: ((props: TypeGuardError.IProps) => Error)

      Custom error factory. Default is TypeGuardError

    Returns Resolved<T>

    Cloned data

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