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 | 22x 90x 127x 13x 114x 114x 114x | import { isObject } from './is-object.js'
export type Defined<T> =
T extends undefined ?
never :
T
/** @returns true if values propagates to undefined, false otherwise. */
export function isDefined<T>(value: T): value is Defined<T> {
if (typeof value === 'undefined') {
return false
}
if (isObject(value)) {
return Object
.values(value)
.some(_ => typeof _ !== 'undefined')
}
return true
}
|