TDS stands for Total Dissolved Solids. Minerals present in the soil remain dissolved in water. They get filtered in underground water. Minerals in surface water reside in the soil on which the water flows (river/stream) or where the water remains stagnant (lake/pond/reservoir). The mineral dissolved in water is generally referred to as the total dissolved solids, TDS. The amount of TDS in water can be measured in milligrams/liter (mg/l) or pieces per million (ppm). These units are identical.
Minerals are basically different components of calcium (CA), magnesium (Mg), and sodium (NA). The salinity in water is due to various constituents of Ca and Mg such as calcium or magnesium chloride, calcium, and magnesium sulfate (CaSo4, MgCl, etc.). Some dissolved solids are dangerous, even in small quantities. For example, arsenic, fluoride, and nitrate. There are certain standards for the accepted levels of these substances in water. However, there is some disagreement about the safe amount of fluoride.
If harmful chemicals such as fluoride and arsenic are released, drinking water must contain some amount of mineral (TDS) but the amount should not be excessive.