The true polymorph spell specifies that:
The target's game statistics, including mental ability scores, are replaced by the statistics of its new form ... The creature is limited in the actions it can perform by the nature of its new form, and it can't speak, cast spells, or take any other action that requires hands or speech, unless its new form is capable of such actions.
So let's take the example of a level 20 Sorcerer who has permanently True Polymorphed himself into a Planetar Angel.
The sorcerer's game statistics are replaced by those of the new form. Does this include class levels? The angel's form doesn't limit the physical ability to use spellcasting, but does the sorcerer retain their class-given spellcasting ability?
The wording of the spell seems to imply the caster is still able to cast their spells, as long as the new form is physically capable of performing the required components.
How about a dragon? They are capable of verbal and somatic components, which are the only requirements for spell usage.