Astro Repo

Astro tsconfig.json File

2 min read

Typescript Paths

Using "@components/*": ["src/components/*"], lets you import files from the components folder using import File from "@components/File.astro", instead of playing with ../ until you find your folder.

tsconfig.json
{
  "extends": "astro/tsconfigs/base",
  "compilerOptions": {
    "strictNullChecks": true,
    "baseUrl": ".",
    "paths": {
      "@components/*": ["src/components/*"],
      "@layouts/*": ["src/layouts/*"],
      "@assets/*": ["src/assets/*"],
      "@utils/*": ["src/utils/*"]
    },
    "jsx": "preserve",
    "jsxImportSource": "solid-js"
  }
}

On this page