router-core/type-safety

Enforce full type inference in TanStack Router code without manual casts.

4|1|Updated Feb 3, 2026
One-click install
npx skills add https://github.com/lespaceman/athena-workflow-marketplace --skill router-core-type-safety-lespaceman
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: router-core/type-safety
Source: https://github.com/lespaceman/athena-workflow-marketplace/tree/main/plugins/tanstack-start/skills/upstream/%40tanstack/router-core/skills/router-core/type-safety
Command: npx skills add https://github.com/lespaceman/athena-workflow-marketplace --skill router-core-type-safety-lespaceman

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Fully describes type-safety by enabling full type inference in router definitions and preventing casts or explicit type annotations.

Core Features & Use Cases

  • Fully inferred params, search params, context, and loader data across routes.
  • Supports module augmentation and getRouteApi for robust, type-safe code-splitting.
  • Use cases include building scalable, type-safe navigations and loader chains without losing inference.

Quick Start

Add this skill to your project and declare the router type registration to enable full inference.

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 params and loaders without manual casts?

Full type inference in TanStack Router is achieved by declaring router type registration and applying module augmentation, ensuring params, search params, context, and loader data are fully inferred without manual casts.

What is the best way to maintain type safety in TanStack Router code-splitting patterns?

Type safety in code-splitting patterns is maintained by leveraging getRouteApi and module augmentation, ensuring robust type narrowing and precise inference across dynamically loaded route components.

Does TanStack Router support end-to-end type inference for route declarations and hooks?

TanStack Router supports end-to-end type inference for route declarations and hooks by enforcing frontmatter metadata and module augmentation, preventing explicit type annotations and ensuring safer composition.

Why does TanStack Router lose type inference on search params and loader data?

Type inference on search params and loader data is lost without proper router type registration, but applying module augmentation and getRouteApi restores fully inferred types across your route tree.

Can I use getRouteApi to enforce type narrowing in TypeScript routing code?

getRouteApi enforces type narrowing in TypeScript routing code by providing a type-safe interface for route parameters and loader data, enabling precise type composition without explicit casts.