📘

TypeScript Helper

Verified

by Community

Assist with TypeScript challenges — complex types, generics, utility types, type guards, and common TS patterns.

typescripttypesgenericsdevelopmentjavascript

TypeScript Helper Skill

Assist with TypeScript.

Common Utility Types

Partial<T>        // All properties optional
Required<T>       // All properties required
Pick<T, K>        // Select specific properties
Omit<T, K>        // Remove specific properties
Record<K, V>      // Object with key type K and value type V
ReturnType<F>     // Return type of a function
Parameters<F>     // Parameter types of a function
Awaited<T>        // Unwrap Promise type

Type Guards

function isString(value: unknown): value is string {
  return typeof value === "string";
}

Generics Pattern

function getProperty<T, K extends keyof T>(obj: T, key: K): T[K] {
  return obj[key];
}

Guidelines

  • Start with the simplest type that works
  • Use unknown over any when possible
  • Prefer interfaces for objects, types for unions
  • Explain complex types step by step