TypeScript Type Wizard
Get help with complex TypeScript types, generics, and utility types
Help me write the correct TypeScript type for this scenario: **What I'm trying to type:** [DESCRIBE — e.g., "a function that takes an object and returns the same object but with all string values uppercased"] **Current attempt (if any):** ```typescript [YOUR_BROKEN_TYPE_ATTEMPT] ``` **Error I'm getting (if any):** ``` [PASTE_TS_ERROR] ``` Please: 1. **Write the correct type** with inline comments explaining each part 2. **Explain the approach** — which TypeScript features you used (mapped types, conditional types, infer, template literals, etc.) 3. **Show it working** — 3-4 usage examples proving the type catches errors and allows valid code 4. **Simplify if possible** — if there's a built-in utility type that does this, use it 5. **Edge cases** — what inputs would break this type, and do we need to handle them? TypeScript version: 5.x (use latest features if helpful)
How to Use This Prompt
- 1Copy the prompt template above
- 2Paste into Claude, ChatGPT, or Cursor
- 3Replace [bracketed placeholders] with your specific project details
- 4Iterate on the AI output to refine and customize the results
More Backend Prompts
Related backend templates from the vault
Rate-Limited API with Token Bucket
Use this prompt to rate-limited api with token bucket with AI assistance
Database Transaction Manager
Use this prompt to database transaction manager with AI assistance
REST API Endpoint Generator
Generate a complete CRUD API endpoint with validation and error handling
Distributed Transaction Saga Implementation
PROImplement a saga pattern for distributed transactions with compensation logic and failure recovery
You Might Also Like
Prompts from other categories that share similar tags
Any Types to Strict TypeScript
Use this prompt to any types to strict typescript with AI assistance
TypeScript Type Error Interpreter
Use this prompt to typescript type error interpreter with AI assistance
API Error Response Standard
Define a consistent error response format across all API endpoints
OpenAPI Specification Generator
Generate a complete OpenAPI 3.1 specification from existing API routes
Keep Exploring the Vault