@sheerid/jslib-nightly
Version:
SheerID JavaScript Library
7 lines (6 loc) • 301 B
TypeScript
/**
* Avoid "can't access property of undefined" errors in a more readable way.
* @param fn Function that wraps a nested property access
* @param defaultVal Optional - the value to return if property access failed
*/
export declare function getSafe<T>(fn: () => T, defaultVal?: T): T | undefined;