The IPFS api type says ipfs.libp2p is undefined so will need to check for libp2p, throw if actually undefined, then directly expose libp2p from opal with the correct type.
Looks like ipfs.libp2p is likely to be deprecated in the future. Should still be fine after but may require creating the libp2p node before and handing it to ipfs if ipfs stops exposing it.
The IPFS api type says ipfs.libp2p is undefined so will need to check for libp2p, throw if actually undefined, then directly expose libp2p from opal with the correct type.