@wordpress/components
Version:
UI components for WordPress.
29 lines • 972 B
TypeScript
/**
* Determines if a value is null or undefined.
*
* @template T
*
* @param {T | null | undefined} value The value to check.
* @return {value is T} Whether value is not null or undefined.
*/
export function isValueDefined<T>(value: T | null | undefined): value is T;
/**
* Determines if a value is empty, null, or undefined.
*
* @template T
*
* @param {T | "" | null | undefined} value The value to check.
* @return {value is T} Whether value is empty.
*/
export function isValueEmpty<T>(value: "" | T | null | undefined): value is T;
/**
* Get the first defined/non-null value from an array.
*
* @template T
*
* @param {Array<T | null | undefined>} values Values to derive from.
* @param {T} fallbackValue Fallback value if there are no defined values.
* @return {T} A defined value or the fallback value.
*/
export function getDefinedValue<T>(values: (T | null | undefined)[] | undefined, fallbackValue: T): T;
//# sourceMappingURL=values.d.ts.map