typescript

Enforce type-safe TypeScript coding with valibot validation and discriminated unions.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/aster-void/dotfiles --skill typescript-aster-void
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: typescript
Source: https://github.com/aster-void/dotfiles/tree/main/modules/home/profile-dev/programs/claude-code/skills/typescript
Command: npx skills add https://github.com/aster-void/dotfiles --skill typescript-aster-void

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill promotes strong TypeScript practices: avoiding any/as/!, and using validators to ensure runtime safety and reliable code.

Core Features & Use Cases

  • No Any / No As: Prefer unknown and validation.
  • Discriminated Unions & Narrowing: Use a type field to narrow variants.
  • Runtime Validation: Use libraries like valibot for runtime checks.

Quick Start

Provide a small TypeScript snippet that validates input with valibot and demonstrates type-safe narrowing.

Frequently Asked Questions about typescript

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

FAQPage Schema
How do I avoid using any and as in TypeScript?

Avoid `any` and `as` by using `unknown` instead, which requires explicit type validation before use. This prevents unsafe type assumptions and catches errors at development time rather than runtime.

What's the best way to safely narrow TypeScript union types?

Use discriminated unions with an explicit `type` field to narrow variants safely. This pattern lets TypeScript's type guard automatically refine the type based on the discriminant value, eliminating unsafe type assertions.

How do I enforce runtime type safety in TypeScript?

Use runtime validation libraries like valibot to check data at runtime and ensure it matches your TypeScript types. This bridges the gap between compile-time types and actual data, preventing type-related bugs in production.

Why should I avoid non-null assertions (!) in TypeScript?

Non-null assertions (`!`) bypass TypeScript's safety checks and hide potential null reference errors. Removing them forces explicit handling of nullable values, making your code more robust and easier to debug.

Can I use discriminated unions for API responses and component props?

Yes, discriminated unions work across APIs, data models, and component props. This approach ensures type-safe handling of different response variants and prop combinations consistently throughout your codebase.