How you return a heavy topspin or backspin shot depends a lot on the placement of the shot.
When you encounter a topspin shot, to counter with a topspin you are attempting to completely reverse the rotation of the ball, subsequently you would tend to have the face of the paddle slightly to moderately closed (forward) while swinging in an upward direction.
Chopping (backspin) a heavy topspin continues the spin that is already on the ball and sometimes adds to that rotation. It takes quite a bit more practice and experience to master a chop, but everyone should be able to have a chop in their repertoire. Again, depending on the spin, the paddle should be more open - at least vertical, probably angled back a bit, because the natural tendency of chopping a topspin is for the ball to climb. Practice will give you a "feel" for what I would call "enveloping" the ball and guiding it back with its own spin still intact. Keep in mind that backspin shots tend to glide in nearly a straight line versus a topspin's downward arc, so it's easier to miss the end of the table by chopping too hard.
Another, and possibly the most popular way of handling a heavy topspin is with neither topspin nor backspin return, but a block. In order to block a topspin you need to be close to the table and catch the heavy topspin ball very shortly after the bounce (not at the peak after the bounce) and literally "block" it by holding the paddle firm and still, angled relatively closed. This has the effect of returning the shot quickly and keeping the opponent's own topspin coming back to them as backspin, often catching them off-guard since a heavy topspin takes a long forehand (or backhand) stroke, and a shot can be blocked back before the player has time to recoil and make another shot.
Returning a heavy backspin again takes practice. When I first learned to play at an advanced level, my coach told me to focus on the "push" shot. He said once you mastered that shot, everything else will make sense and come more quickly, and he was right. A push is simply pushing the ball back and forth with your partner with a low amount of incidental backspin. As you get a feel for that, you can gradually see how you need to adjust your push to return heavier and heavier backspins. If a ball comes to you short, like on a serve, where it would bounce twice on the table if not hit, you almost have to push it back unless it's high enough to hit with topspin.
If the backspin ball comes deeper, you have the option of hitting the ball with topspin or chopping the ball back. If you are an advanced player, you have the option of looping the ball, which imparts heavy topspin. Looping a chop can often be more effective than looping a topspin or counter-looping, as looping a chop again continues its own spin and adds more spin to it. The topspin allows for you to aim higher since the more topspin, the quicker the ball will arc down to the table (and the lower it will bounce when it hits the table).
Counter-chopping a deep ball takes a lot of touch, usually a very open-faced paddle, and risks a loop return from your opponent.
Looping is probably the most exciting shot to watch in table tennis as it involves a very long (usually) deliberate swing of the paddle that barely grazes the ball and sends it back with tremendous spin. It can take a long time of practice to work up to looping, but if you work at it, there's nothing like that first successful loop shot!
Hope this has been helpful.