Programování Expert Claude

TypeScript types pro complex data

Vytvoření type-safe TypeScript definic pro komplexní data struktury.

Prompt text

Délka: Střední
Vytvoř TypeScript types pro:

**Data Structure:**
[POPIS STRUKTURY - např. API response, form data, configuration]

**Requirements:**
1. Type safety - no `any`
2. Readonly where appropriate
3. Union types pro polymorphism
4. Generics kde vhodné
5. Utility types (Pick, Omit, Partial)
6. Type guards pro runtime checks

**Include:**
- Interface/Type definitions
- Enum pro constants
- Type guards functions
- JSDoc comments
- Usage examples

**Validation:**
- Zod/Yup schema (optional)
- Runtime validation

**Example JSON:**
```json
[EXAMPLE DATA]
```

TS version: [VERSION]. Strict mode: [YES/NO].
Interaktivní tvůrce

Příklad použití

Vstup:

Vytvoř types pro API response s user data (polymorphic - user může být Customer/Admin/Guest, každý má jiné fields). Include type guards. [vloží example JSON]

Výstup:

Complete type definitions: Base User interface, discriminated union type (UserType = Customer | Admin | Guest), each with specific fields, type guards (isCustomer, isAdmin, isGuest using "kind" discriminator), readonly for immutable data, generic ApiResponse<T>, Zod schemas for runtime validation, utility types (UserUpdate = Partial<User>), enums for UserRole, JSDoc s examples. Usage examples showing type narrowing s type guards. Full type safety, zero `any`.

Kde použít tento prompt?

Najděte vhodné AI nástroje pro použití tohoto promptu a maximalizujte jeho efektivitu.

Objevte další AI prompty

Prozkoumejte naši sbírku Programování promptů a najděte ty, které vám pomohou dosáhnout lepších výsledků.