I have giant Revolt Advanced 2 with Rear Derailleur Shimano GRX RX-810 with 2x up front.
https://www.giant-bicycles.com/us/revolt-advanced-2
I installed 11-40 Shimano Deore XT M8000 11-speed Cassette. It works good enough for me. It does not
shift as nice as the 11-34 that came with the bike. I prefer the 11-40 for the mnt bike trails that are over 15%. I can't imagine how the 11-42 would fit. The 11-40 is pretty tight.
The biggest draw back is when I put my road wheel set on ( 11-30 ) I have to make adjustments to the b screw. Before I had to do nothing switching between my gravel wheel set when it was 11-34 and my road wheel set of 11-30.