When a TV and soundbar both offer HDMI ARC/eARC and Optical, choose HDMI. Even basic ARC matches Optical's audio-format support while allowing audio to travel in both directions over the connection.
For more background, the source publication also offers articles explaining HDMI and HDMI ARC/eARC.
Why TVs Need an Audio Return Connection
Before Smart TVs became widespread, a display mainly received video. Sources such as satellite receivers, consoles, and video players commonly connected to an AVR (audio/video receiver), which handled audio and forwarded video to the TV.
Built-in streaming apps such as Netflix made TVs audio sources as well. Alongside the shift from AVRs toward soundbars, this created a need to send TV-generated audio to an external sound system.
How HDMI Compares With Optical
The traditional approach adds a separate cable, often Optical/TOSLINK, between the TV and audio system. HDMI 1.4 introduced ARC (Audio Return Channel) before internet-capable TVs became mainstream. ARC carries audio in both directions over an HDMI connection, removing the need for that additional return cable.

ARC and its successor, eARC (Enhanced Audio Return Channel), also offer functionality such as shared device controls. For audio quality and supported formats, ARC equals Optical; eARC goes further, with substantially greater audio bandwidth and format support.

However, an HDMI connection only provides ARC/eARC when both the TV and the soundbar or AVR support it. Check the port labels on both devices before connecting them.

Which Should You Choose?
Use HDMI when both devices support ARC/eARC: it provides at least Optical's audio capabilities, with greater setup flexibility. The source publication's soundbar setup guide offers further connection help. Questions can also be sent by email.