How to just check if a channel is live?

Not exactly the same.

If you the stream is offline you’ll get a response like:

{ data: [] };

So if you check for viewers:

const stream = data[0];

if(stream.viewers !== null) {
    console.log('Stream Online');
} else {
    console.log('Stream Offline');
}

This will throw an error when the stream is offline because TypeError: Cannot read property 'viewers' of undefined, as there is no data[0] when the stream is offline (this is just when checking a single stream btw, there may be other stream objects if looking up multiple channels).

Sure you could catch and handle the error, but it’s bad practice when you can much more easily check if the object itself exists, and not error at all.