9 lines
237 B
TypeScript
9 lines
237 B
TypeScript
|
|
export type NotFunc = string | number | boolean | object;
|
|
|
|
export type Lazy<T extends NotFunc> = T | (() => T);
|
|
|
|
export function resolve_lazy<T extends NotFunc>(lazy: Lazy<T>) : T {
|
|
return typeof lazy === 'function' ? lazy() : lazy;
|
|
}
|