TMS and electroconvulsive therapy (ECT) are both brain-stimulation treatments, but they are very different.

TMS uses magnetic pulses and does not require anesthesia or intentionally cause a seizure.

ECT is performed under anesthesia and uses an electrical current to produce a controlled seizure. ECT is an important and highly effective treatment for some severe psychiatric illnesses, but it can cause memory-related side effects. (nimh.nih.gov)

Your clinician can help determine which treatment is appropriate for your situation.