If a Pokemon changes its type before Terastallizing, does it get STAB for its original types or the types it had immediately before Terastallizing? Are Terastal Pokemon immune to type changes? If no, what types get STAB after a Terestal Pokemon changes its type? Please do not question my curiosity.
Bulbapedia article has been edited since I asked the question.
While Terastallized, Pokémon receive STAB on moves matching their Tera Type, in addition to moves matching their original types. The original types are the types they had immediately before Terastallizing (taking type changes into account but ignoring Forest's Curse) or their base types if they were sent on the field while Terastallized. If the Pokémon's Tera Type is the same as one of its original types, moves of that type receive a damage boost of 2 instead of the usual 1.5.
During this time, Adaptability works only for the Tera Type (with 1.5 becoming 2, and 2 becoming 2.25).
Terastallized Pokémon cannot have their type changed from moves and Abilities such as Soak, Double Shock, Imposter, Protean, or Transform. A Pokémon using Transform before Terastallizing will not copy its opponent's Tera Type and will instead keep its own.
source