Installation
Automatic Installation
- Add integration:
npx astro add astro-typesafe-routes
- Start the Astro development server if it's not already running to run type generation:
npm run dev
Manual Installation
- Install Typescript if it's not already installed.
npm i -D typescript
- Install package:
npm install -D astro-typesafe-routes
- Add integration to
astro.config.mjs
:
import { defineConfig } from 'astro/config';
import astroTypesafeRoutes from "astro-typesafe-routes"
export default defineConfig({
integrations: [
astroTypesafeRoutes()
]
});
- Start the Astro development server if it's not already running to run code generation:
npm run dev