typescript-expert

Guide TypeScript type system usage with generics, conditional types, and strict mode patterns.

18.1k|2.3k|Updated Feb 24, 2026
One-click install
npx skills add https://github.com/RightNow-AI/openfang --skill typescript-expert-rightnow-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript-expert
Source: https://github.com/RightNow-AI/openfang/tree/main/crates/openfang-skills/bundled/typescript-expert
Command: npx skills add https://github.com/RightNow-AI/openfang --skill typescript-expert-rightnow-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write more robust, type-safe TypeScript code by leveraging advanced type system features and best practices.

Core Features & Use Cases

  • Type Safety: Enforces strict mode and guides the use of generics, conditional types, and mapped types.
  • Code Quality: Provides patterns to avoid common pitfalls like unnecessary type assertions and over-engineered generics.
  • Use Case: A developer struggling with complex generic types in a library can consult this Skill for idiomatic solutions and patterns to ensure type safety and maintainability.

Quick Start

Explain how to use branded types in TypeScript to create nominal string types.

Frequently Asked Questions about typescript-expert

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use mapped types in TypeScript to define complex transformations?

Mapped types in TypeScript enable complex transformations by applying conditional logic to iterate over object properties. They ensure type-safe APIs by transforming existing structures into new types while maintaining strict mode patterns for robust error handling.

What is the best way to implement robust error handling with discriminated unions in TypeScript?

Discriminated unions enable robust error handling in TypeScript by creating types with a common literal property, allowing exhaustive checks. This pattern ensures all potential states are handled, promoting idiomatic TypeScript and preventing runtime errors.

How do I create type-safe APIs using TypeScript generics without over-engineering?

TypeScript generics create type-safe APIs by capturing parameter types for reuse, but avoiding over-engineering requires applying idiomatic patterns. Focus on strict mode constraints and simple conditional types to ensure code readability and maintainability.

Why does TypeScript strict mode cause type errors in my code and how do I fix them?

TypeScript strict mode causes type errors by enforcing strict null checks and explicit types to prevent runtime failures. Fix them by adopting idiomatic patterns like mapped types and discriminated unions, avoiding unnecessary type assertions.

When do I need conditional types for type-safe programming in TypeScript?

You need conditional types in TypeScript when building logic that selects types based on other types, such as defining complex transformations. They act as a mechanism to enforce type safety and create flexible, reusable API definitions.

How to use branded types in TypeScript to create nominal string types?

Branded types in TypeScript create nominal string types by adding a unique property marker to a base string type. This technique enforces strict type safety, preventing accidental assignment between structurally identical strings and ensuring robust API definitions.