Astro Typesafe Routes integrates seamlessly into your Astro project, offering automatic type safety for your routes. Ensure your project uses Astro version 5.0.0 or higher. Follow the steps below to set it up and enhance your development experience.
^5.0.0
is requirednpm i -D typescript @astrojs/check
astro check
command to build script in package.json{
"scripts": {
"build": "astro check && astro build"
}
}
npx astro add astro-typesafe-routes
npm run dev
If automatic installation didn’t work, follow these steps:
npm install astro-typesafe-routes
import { defineConfig } from "astro/config";
import astroTypesafeRoutes from "astro-typesafe-routes";
export default defineConfig({
integrations: [astroTypesafeRoutes()],
});
npm run dev