TypePilot: Leveraging the Scala Type System for Secure LLM-generated Code