Cursor

TypeScript Utility Function Builder

Prompt
Act as a TypeScript expert. Write a reusable utility function for [use case] with full generic types, exhaustive edge case handling, JSDoc comments, and Vitest unit test examples covering happy path and failure modes.

How to use this prompt

  1. Copy the prompt above using the copy button

  2. Open Cursor and start a new conversation

  3. Paste the prompt and replace [bracketed variables] with your specifics

Look for [placeholder] text in the prompt — replace these with your specific details for best results.

Related Topics

834 copies391 upvotes