Repository navigation
fix(docs): load Next's image types in a committed declaration file - #270
Merged
Merged
Conversation
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.
Contributor
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Contributor
There was a problem hiding this comment.
🟢 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
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.
Why
CI's typecheck job has failed on
mainsince #268, and every branch cut frommaininherits it, including #269.scene.tsxin FlutedGlass importsanthurium.webp. The types for that import come fromnext/image-types/global, which onlynext-env.d.tsloads. That file is gitignored and appears only afternext devornext build, sotsc --noEmiton a fresh checkout can't resolve the import.What changes
apps/docs/image-types.d.tsis a new committed file that referencesnext/image-types/global, andtsconfig.jsonincludes it. A static image import now types asStaticImageData, whichusePhotoalready expects, whether or notnext-env.d.tsexists.