export interface Supplier<T> { (): T; } export const SUPPLY_UNDEFINED: Supplier<undefined> = () => undefined; export function orUseSupplier<T>(item: T | undefined, supplier: Supplier<T>): T { return item || supplier(); }