Shimming it width wise is fine, it’s the length of shim that’s the issue. Most shims are 100mm, if you’ve got plenty of post down below that and/or the shim isn’t well below the welds the you could have problems.
I used a 27.2 post in a 30.9 tube for years before I eventually bought a dropper – USE thermoplastic shim with about 90mm in the seat tube, I weigh about 90kg. It did clear the lower weld on the top tube though, and there’s a brace.
I’d be guided by what your frame maker says, they may have a specified minimum insertion. Ooh er etc. It’d be a shame to have to retire a nice post if you didn’t have to, more of a shame if you damage your frame though!
As above, check the minimum insertion for the frame (not the seatpost). In my experience, 100 mm is fine, as long as the shim extends down to the lower weld on the toptube. My old Giant NRS came from the factory with a 30.9 seattube shimmed down to use a 27.2 post. I’ve run 27.2 Gravity Dropper posts on all my bikes for well over a decade, they’ve mostly had seattubes 30.9 mm or bigger.
I have also shimmed 31.6 down to 27.2. But to get a long enough and well supported insertion below the top tube weld, I used 2 USE shims bonded together. I had to cut the collar off the lower one. Worked fine.