@bckmnn/types Demo

Shared TypeScript Type Definitions

← Zurück zur Hauptseite

User Types

User Interface

Typisierte Benutzer-Datenstruktur

interface User {
  id: string;
  email: string;
  name: string;
  role: 'admin' | 'user' | 'guest';
  createdAt: Date;
  preferences: UserPreferences;
}

Demo User Data:

ID:
user_123
Email:
demo@bckmnn.com
Role:
admin
Created:
15.01.2024

User Preferences

Verschachtelte Type-Definitionen

interface UserPreferences {
  theme: 'light' | 'dark' | 'system';
  language: string;
  notifications: boolean;
}

Demo Preferences:

Theme:
dark
Language:
de-DE
Notifications:
true

API Response Types

Generic API Response

Typisierte API-Antworten mit Generics

interface ApiResponse<T = any> {
  data: T;
  status: 'success' | 'error';
  message?: string;
  timestamp: Date;
  meta: ResponseMeta;
}

Demo Response:

Status:
success
Message:
Users fetched successfully
Timestamp:
30.01.2026
Data Count:
1

Response Metadata

Pagination und zusätzliche Informationen

interface ResponseMeta {
  page?: number;
  limit?: number;
  total?: number;
  hasNext?: boolean;
  hasPrev?: boolean;
}

Demo Meta:

Page:
1
Limit:
10
Total:
1

Authentication Types

Auth State Interface

Typisierter Authentication-Zustand

interface AuthState {
  isAuthenticated: boolean;
  user: User | null;
  token: string | null;
  refreshToken: string | null;
  expiresAt: Date | null;
}

Demo Auth State:

Authenticated:
true
User:
Demo User
Token:
Present
Expires:
30.01.2026

Type Safety Benefits

Development Experience

Vorteile der TypeScript-Integration

Auto-completion
Compile-time Checks
Refactoring Safety
Documentation
IDE Integration

Runtime Safety

Laufzeit-Validierung und Error-Handling

Type Guards
Runtime Validation
Error Boundaries
Graceful Degradation
Debug Information

Monorepo Integration

Geteilte Types zwischen Packages

Cross-package Consistency
Single Source of Truth
Version Synchronization
Breaking Change Detection
API Contract Enforcement