tsentials-union

Community

Model multiple outcomes with type-safe matching.

Authorsenrecep
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Union types let you represent multiple distinct outcomes, but developers often fall back to untyped object returns or unsafe casting, losing exhaustiveness and correctness guarantees.

Core Features & Use Cases

  • Tagged discriminated union: define outcomes like success, pending, and failed with compile-time-safe payloads.
  • Exhaustive pattern matching: use Union.match() so TypeScript flags missing cases.
  • Type guards and extraction: use Union.is() for narrowing and Union.get() to extract a specific branch value.

Quick Start

Ask your AI to rewrite your service return type to use Union<T> and refactor your response mapping with Union.match() for exhaustive handling.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: tsentials-union
Download link: https://github.com/senrecep/tsentials/archive/main.zip#tsentials-union

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.