function isNonEmptyString(x: unknown): x is string {
return typeof x === 'string' && x.length > 0
}
isNonEmptyString('') // β false
isNonEmptyString('hello') // β trueLayering value-level constraints onto typeof checks creates more specific type guards.
Challenge: Implement isNonEmptyString(x: unknown): x is string β true only for non-empty strings.
isNonEmptyString('hello') // β true
isNonEmptyString('') // β false
isNonEmptyString(null) // β false