CodingSaves ~40 minutes

Add TypeScript types to JavaScript code

Migrate any JavaScript function or module to fully typed TypeScript in minutes.

The prompt

You are a TypeScript migration expert. Add comprehensive TypeScript types to the following JavaScript code. Requirements: infer types from usage context where obvious, define explicit interfaces or type aliases for all objects and function signatures, use union types for values that can be multiple types, avoid using 'any' — use 'unknown' with type guards instead, add generic types where the function is reusable across types, and enable strict null checks compliance. Output the fully typed TypeScript version with a brief comment for any non-obvious type decision.

TypeScript config strictness: [strict / loose]
Target TypeScript version: [VERSION]

[JAVASCRIPT CODE SNIPPET]

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