diff --git a/packages/astro/components/Font.astro b/packages/astro/components/Font.astro index 13b464ce4aad..116b3bbc98b8 100644 --- a/packages/astro/components/Font.astro +++ b/packages/astro/components/Font.astro @@ -13,7 +13,7 @@ interface Props { preload?: boolean; } -const { cssVariable, preload = false } = Astro.props; +const { cssVariable, preload = false } = Astro.props as Props; const data = fontsData.get(cssVariable); if (!data) { throw new AstroError({ diff --git a/packages/astro/components/Picture.astro b/packages/astro/components/Picture.astro index 08d7e1cd3bc1..8ebb4995f96c 100644 --- a/packages/astro/components/Picture.astro +++ b/packages/astro/components/Picture.astro @@ -54,6 +54,7 @@ if (useResponsive) { for (const key in props) { if (key.startsWith('data-astro-cid')) { + // @ts-expect-error This is for island props so they're not properly typed pictureAttributes[key] = props[key]; } } diff --git a/packages/astro/components/env.d.ts b/packages/astro/components/env.d.ts new file mode 100644 index 000000000000..20e8db968b15 --- /dev/null +++ b/packages/astro/components/env.d.ts @@ -0,0 +1,2 @@ +/// +/// \ No newline at end of file diff --git a/packages/astro/components/tsconfig.json b/packages/astro/components/tsconfig.json new file mode 100644 index 000000000000..71b1925eb046 --- /dev/null +++ b/packages/astro/components/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "allowJs": true, + "emitDeclarationOnly": false, + "noEmit": true, + "jsx": "preserve" + } +} diff --git a/packages/astro/dev-only.d.ts b/packages/astro/dev-only.d.ts index 5a5420a95ced..54a6b365f80d 100644 --- a/packages/astro/dev-only.d.ts +++ b/packages/astro/dev-only.d.ts @@ -3,3 +3,7 @@ declare module 'virtual:astro:env/internal' { export const schema: import('./src/env/schema.js').EnvSchema; } + +declare module 'virtual:astro:assets/fonts/internal' { + export const fontsData: import('./src/assets/fonts/types.js').ConsumableMap; +} diff --git a/packages/astro/package.json b/packages/astro/package.json index e9a6ef155db4..c047f4517343 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -80,7 +80,7 @@ "astro": "astro.js" }, "files": [ - "components", + "components/*.{astro,css,ts}", "tsconfigs", "dist", "types", @@ -99,7 +99,7 @@ ], "scripts": { "prebuild": "astro-scripts prebuild --to-string \"src/runtime/server/astro-island.ts\" \"src/runtime/client/{idle,load,media,only,visible}.ts\"", - "build": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm && tsc", + "build": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm && tsc && astro-check --root ./components", "build:ci": "pnpm run prebuild && astro-scripts build \"src/**/*.{ts,js}\" --copy-wasm", "dev": "astro-scripts dev --copy-wasm --prebuild \"src/runtime/server/astro-island.ts\" --prebuild \"src/runtime/client/{idle,load,media,only,visible}.ts\" \"src/**/*.{ts,js}\"", "test": "pnpm run test:unit && pnpm run test:integration && pnpm run test:types", @@ -210,6 +210,7 @@ "remark-code-titles": "^0.1.2", "rollup": "^4.37.0", "sass": "^1.86.0", + "typescript": "^5.8.3", "undici": "^7.5.0", "unified": "^11.0.5", "vitest": "^3.0.9" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 61ac128cbf24..c585997d3b2e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -740,6 +740,9 @@ importers: sass: specifier: ^1.86.0 version: 1.86.3 + typescript: + specifier: ^5.8.3 + version: 5.8.3 undici: specifier: ^7.5.0 version: 7.6.0 @@ -10512,6 +10515,7 @@ packages: libsql@0.5.4: resolution: {integrity: sha512-GEFeWca4SDAQFxjHWJBE6GK52LEtSskiujbG3rqmmeTO9t4sfSBKIURNLLpKDDF7fb7jmTuuRkDAn9BZGITQNw==} + cpu: [x64, arm64, wasm32] os: [darwin, linux, win32] lightningcss-darwin-arm64@1.29.2: