CodingSaves ~1 hour
Convert a JS module to TypeScript
Get a complete, working TypeScript conversion of any JavaScript module ready to drop in.
The prompt
You are a TypeScript migration engineer. Convert the following JavaScript module to TypeScript. Follow these steps: (1) Add file extension change notes, (2) Define interfaces or types for all data structures, (3) Type all function parameters and return values, (4) Handle null/undefined cases explicitly, (5) Replace CommonJS require/module.exports with ES module imports/exports if appropriate, (6) Identify any patterns that need refactoring to be type-safe, and (7) Note any areas where 'as' casting was necessary and suggest better alternatives. Produce the complete converted file ready to save as .ts. Module purpose: [BRIEF DESCRIPTION] Existing JS module: [PASTE FULL JS FILE]
Replace the [BRACKETED] fields with your details, then paste into ChatGPT, Claude or Gemini.
Want AI to fill this in for you?
Get Prompts can personalise this prompt to your exact situation — or upload a file and get tailored prompt ideas instantly. 3 free edits, no sign-up.
Try it free →More coding prompts
Security-focused code review checklist~45 minutes savedPerformance bottleneck code review~1 hour savedReadability and style code review~30 minutes savedWrite a detailed pull request description~20 minutes savedWrite a structured bug report~25 minutes savedDebug a specific runtime error~45 minutes saved