/** * Get origin value type. * * @template Instance Target instance * @author Jeongho Nam - https://github.com/samchon */ export type ValueOf = is_value_of extends true ? boolean : is_value_of extends true ? number : is_value_of extends true ? string : Instance; type is_value_of< Instance, Object extends IValueOf, > = Instance extends Object ? Object extends IValueOf ? Instance extends Primitive ? false : true // not Primitive, but Object : false // cannot be : false; interface IValueOf { valueOf(): T; }