UNPKG

tgrid

Version:

Grid Computing Framework for TypeScript

13 lines (12 loc) 575 B
/** * Get origin value type. * * @template Instance Target instance * @author Jeongho Nam - https://github.com/samchon */ export type ValueOf<Instance> = is_value_of<Instance, Boolean> extends true ? boolean : is_value_of<Instance, Number> extends true ? number : is_value_of<Instance, String> extends true ? string : Instance; type is_value_of<Instance, Object extends IValueOf<any>> = Instance extends Object ? Object extends IValueOf<infer Primitive> ? Instance extends Primitive ? false : true : false : false; interface IValueOf<T> { valueOf(): T; } export {};