Skip to content

fix(docs): load Next's image types in a committed declaration file - #270

Merged
hunterbecton merged 1 commit into
mainfrom
t3/fix-pr-269-build-typecheck
Oct 31, 2026
Merged

hunterbecton merged 1 commit into
mainfrom
t3/fix-pr-269-build-typecheck

Conversation

@hunterbecton

Copy link
Copy Markdown
Member

Why

CI's typecheck job has failed on main since #268, and every branch cut from main inherits it, including #269. scene.tsx in FlutedGlass imports anthurium.webp. The types for that import come from next/image-types/global, which only next-env.d.ts loads. That file is gitignored and appears only after next dev or next build, so tsc --noEmit on a fresh checkout can't resolve the import.

What changes

apps/docs/image-types.d.ts is a new committed file that references next/image-types/global, and tsconfig.json includes it. A static image import now types as StaticImageData, which usePhoto already expects, whether or not next-env.d.ts exists.

The FlutedGlass scene imports anthurium.webp. The types for that import
come from next/image-types/global, which only next-env.d.ts loads.
next-env.d.ts is gitignored and appears only after `next dev` or
`next build`, so `tsc --noEmit` failed on a fresh checkout, and CI has
been red on main since #268.
Copilot AI balanced review requested due to automatic review settings October 31, 2026 11:11
@github-actions

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit bfe99af.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

There are no active review issues for the fresh-checkout docs typechecking fix.

No open issues 🎉

What changed in this PR

Fixes fresh-checkout typechecking in the docs app by loading Next.js static image types without relying on the generated, gitignored next-env.d.ts.

Changes:

  • Adds a committed declaration file referencing next/image-types/global.
  • Includes that file in the docs TypeScript configuration so static image imports resolve before running Next.js.
File Description
apps/​docs/​tsconfig.json Includes the committed image-type declaration.
apps/​docs/​image-types.d.ts Loads Next.js image types and explains why an explicit reference is needed.

Review effort: Balanced

@hunterbecton
hunterbecton merged commit 2123d5e into main Oct 31, 2026
12 checks passed
@hunterbecton
hunterbecton deleted the t3/fix-pr-269-build-typecheck branch October 31, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants