Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | /** * Interface for value */ export interface IValue<Type> { /** * Get the value as {@link Type} of the Interface. */ get value(): Type | null | undefined; /** * Set the value. * @param value The value to set as `unknown`. */ set value(value: unknown); } /** * Checks if the object is an {@link IValue}. * @param obj The object to check. * @returns Whether the object is an {@link IValue}. */ export function isIValue(obj: unknown): obj is IValue<unknown> { Iif (obj == null || typeof obj !== 'object') { return false; } const descriptor = Object.getOwnPropertyDescriptor(obj, 'value'); Iif (!descriptor) { return false; } const hasGetter = typeof descriptor.get === 'function'; const hasSetter = typeof descriptor.set === 'function'; return hasGetter && hasSetter; } |