router-core/type-safety

Configures TanStack Router projects with full inference and module augmentation for typed navigation and loader data access.

Updated Apr 2, 2026
One-click install
npx skills add https://github.com/abereghici/skills --skill router-core-type-safety-abereghici
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: router-core/type-safety
Source: https://github.com/abereghici/skills/tree/main/skills/tanstack-router/type-safety
Command: npx skills add https://github.com/abereghici/skills --skill router-core-type-safety-abereghici

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

TanStack Router users often face fragile type handling and boilerplate when wiring routes across a large app. This skill enforces full type inference, required registration, and precise type flows to keep an app strongly typed without excessive annotations.

Core Features & Use Cases

  • Fully inferred params, search params, context, and loader data across the route tree without explicit casts.
  • Register via module augmentation to provide global typings for Link, useNavigate, and route hooks.
  • Use cases include large route trees, type-safe data loading, and precise navigation with narrowed hooks.

Quick Start

Follow the Type Safety guide to wire a TanStack Router with full type inference and declare module augmentation.

Frequently Asked Questions about router-core/type-safety

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

FAQPage Schema
How do I get fully inferred TypeScript types for TanStack Router params and loader data?

To get fully inferred TypeScript types for TanStack Router, you must register your router via module augmentation. This provides global typings for params, search params, context, and loader data without requiring explicit type casts.

What is module augmentation for type-safe routing in TanStack Router?

Module augmentation for type-safe routing is a TypeScript technique that registers your router's route tree globally. It enables precise type inference for navigation hooks, Link components, and loader data access across your codebase.

Do I need TypeScript to use type inference for large route trees in TanStack Router?

Yes, TypeScript is required to use type inference for large route trees in TanStack Router. The type-safety patterns rely on TypeScript's module augmentation to enforce precise type flows and narrowed hook results.

What's the best way to avoid type casting when wiring TanStack Router navigation?

The best way to avoid type casting when wiring TanStack Router navigation is to apply full type inference through router registration. This ensures Link, useNavigate, and route hooks receive strictly typed parameters automatically.

Why does my TanStack Router loader data lose type safety across complex route trees?

TanStack Router loader data loses type safety when the router is not globally registered via module augmentation. Without this registration, TypeScript cannot infer the precise data types across complex route trees, resulting in fragile type handling.