fix(types): declare fontsource modules for TypeScript 6 (ts2882) - #710
Merged
prototypa merged 1 commit intoJun 4, 2026
Merged
Conversation
Fontsource packages ship CSS only, so the side-effect import `import '@fontsource-variable/inter'` in CustomStyles.astro has no type declarations. Under TypeScript 6 strict, that is an error (ts2882: cannot find module or type declarations for side-effect import). Add ambient module declarations for @fontsource-variable/* and @fontsource/* in env.d.ts. Build behavior is unchanged; Vite still resolves and bundles the CSS. Related to arthelokyo#707.
prototypa
approved these changes
Jun 4, 2026
Contributor
|
Thanks @danfitz36 |
prototypa
added a commit
that referenced
this pull request
Aug 4, 2026
…ort-types fix(types): declare fontsource modules for TypeScript 6 (ts2882)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Resolves the
ts(2882)error on the fontsource side-effect import insrc/components/CustomStyles.astrounder TypeScript 6.0 (stricton by default).Related to #707. Third and final piece of vanilla-template TS 6 readiness, alongside #708 (
permalinks.ts) and #709 (blog.ts).Why
CustomStyles.astroloads the font via a side-effect import:Fontsource packages ship CSS only — no
.d.ts. Under TS 6, a side-effect import of a module with no type declarations is an error:Change
Add ambient module declarations in
src/env.d.ts:(Both scopes are declared since the commented-out font options in
CustomStyles.astroinclude non-variable@fontsource/*families.) Purely a type-level shim — Vite still resolves and bundles the CSS, so build output is unchanged.Verification
With
typescript@6,npx astro checkno longer reports thets(2882)error (CustomStyles.astrois clean).eslintandprettierpass.With #708 and #709 also applied,
astro checkreports 0 errors on a vanilla AstroWind install under TypeScript 6.