My Shimano Tourney RD-TY22 7–21 speed bike rear derailleur mech, direct attach has broken, need a replacement, preferably newer
Specific product recommendations are off topic here, but I can tell you that pretty much any Shimano MTB 7, 8 or 9 speed derailleur will work.

The reason for this is that the shifter controls the amount of cable pulled for each gear change. The derailleur has an 'actuation ratio' which is the ratio of lateral movement to cable length pulled. Shimano 7, 8 or 9 speed derailleurs all use the same actuation ratio and the shifters are responsible for pulling the correct amount of cable for the 7, 8 or 9 speed sprocket spacing.

Derailleurs from the Tourney TX (the highest Tourney level), Altus or Acera lines will be a step up from your current derailleur.

You will need to check the specs of the derailleurs you consider, specifically: the max largest sprocket that can be accommodated and and the 'total capacity' which is the  max (difference in size small and large chainrings) + (difference in size small and large cassette sprockets), measured in teeth. and represents how much chain slack the derailleur can take up.

Specs can be looked up on Shimano's site here: http://si.shimano.com/#/