router-core/type-safety

Enforce full type inference across TanStack Router routes, hooks, and navigation.

6|1|Updated Jun 1, 2025
One-click install
npx skills add https://github.com/rezics/rezics --skill router-core-type-safety-rezics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: router-core/type-safety
Source: https://github.com/rezics/rezics/tree/main/.agents/skills/tanstack/router/router-core/type-safety
Command: npx skills add https://github.com/rezics/rezics --skill router-core-type-safety-rezics

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Fully type-inferred TanStack Router usage, preventing casts and explicit generic annotations that break inference.

Core Features & Use Cases - Ensures type safety across links, params, search, and loader data. - Provides a single registration pattern to type-check router APIs and narrows types with from, improving maintainability in large apps. - Includes utilities like addChildren with object syntax and ValidateLinkOptions to keep components strongly typed.

Quick Start Register the router types and use type-safe hooks to enable fully type-safe navigation and data access.

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 full type inference for TanStack Router hooks and navigation?

Full type inference for TanStack Router hooks and navigation is achieved by registering router types via module augmentation. This setup enables precise type narrowing for Link, useParams, and useLoaderData without explicit generic annotations or casts.

Why does my TanStack Router code require manual type casts for params and loader data?

TanStack Router code requires manual type casts when project setup lacks proper module augmentation for type registration. Applying a single registration pattern enforces type safety across links, params, search, and loader data, eliminating the need for brittle casts.

What is the best way to maintain type safety in complex TanStack Router route trees?

The best way to maintain type safety in complex TanStack Router route trees is using type-safe utilities like addChildren with object syntax. This approach ensures strongly typed components and improves maintainability in large applications.

Can I use ValidateLinkOptions to type-check TanStack Router Link components?

Yes, you can use ValidateLinkOptions to type-check TanStack Router Link components. This utility keeps components strongly typed by validating link options against the registered route tree, preventing invalid navigation paths.

Does TanStack Router type inference work with TypeScript without manual generic annotations?

TanStack Router type inference works with TypeScript without manual generic annotations when you register router types correctly. The type-safe utilities infer types from the route tree, narrowing types with the from property for typed access.