router-core/type-safety

Installation
SKILL.md

Type Safety

TanStack Router is FULLY type-inferred. Params, search params, context, and loader data all flow through the route tree automatically. The #1 AI agent mistake is adding type annotations, casts, or generic parameters to values that are already inferred.

CRITICAL: NEVER use as Type, explicit generic params, satisfies on hook returns, or type annotations on inferred values. Every cast masks real type errors and breaks the inference chain. CRITICAL: Do NOT confuse TanStack Router with Next.js or React Router. There is no getServerSideProps, no useSearchParams(), no useLoaderData() from react-router-dom.

The ONE Required Type Annotation: Register

Without this, top-level exports like Link, useNavigate, useSearch have no type safety.

// src/router.tsx
import { createRouter } from '@tanstack/react-router'
import { routeTree } from './routeTree.gen'

const router = createRouter({ routeTree })
Installs
GitHub Stars
16
First Seen
router-core/type-safety — lightfastai/lightfast