Another use that is a valid use of a TSP loan might be...if you are purchasing a home, and need the money to increase the down payment enough to get either a lower rate, or to avoid the extra expense of Private Mortgage Insurance (PMI).
Only you can figure out if the cost of missed future retirement earnings is worth taking out a TSP loan. The general rule is...if you can afford to live without taking out a TSP loan, then do so.
If you have an unforseen financial emergency and no other cushion, then you can consider a TSP loan as a possibility, or if you are better off financially on a home loan that makes the numbers work, then it is worthwhile calculating and seeing if it is right for you.
Only you can answer that question.
(Yes, I did a 15-year TSP loan when I bought a home, and it was worthwhile to me. I managed to pay it off in 7 years, too).
Good luck.