Thermally-pulsing asymptotic giant branch stars in the Magellanic Clouds