Sun Joe 40-Volt Cordless Pole Chain Saw, 8"

I have a Ryobi 40v string trimmer, with what looks to be an identically shaped battery. It’d be nice to know if these batteries were identical or not, then I’d have two chargers, two batteries, and a pole saw to go with the string trimmer.