Skip to main content
Version: 4.0.0

Installation

Astro Typesafe Routes integrates seamlessly into your Astro project, offering automatic type safety for your routes. Ensure your project uses Astro version 4.14.0 or higher (compatible with v4 and v5). Follow the steps below to set it up and enhance your development experience.

Requirements

  • Astro Typesafe Routes is compatible with Astro version 4 and 5, with a minimum of 4.14.0.
  • Astro and Typescript are required peer dependencies.

Automatic Installation

  1. Setup Typescript for Astro.
  2. Add integration:
npx astro add astro-typesafe-routes
  1. Start the Astro development server if it's not already running to run type generation:
npm run dev
  1. Done! If you ran into any issues, try manual installation.

Manual Installation

  1. Setup Typescript for Astro.
  2. Install package:
npm install astro-typesafe-routes
  1. Add integration to astro.config.mjs:
import { defineConfig } from 'astro/config';
import astroTypesafeRoutes from "astro-typesafe-routes"

export default defineConfig({
integrations: [
astroTypesafeRoutes()
]
});
  1. Start the Astro development server if it's not already running to run code generation:
npm run dev
  1. Done!