fix: add type declarations for css export (TypeScript 6 compat)#16348
Open
andershermansen wants to merge 1 commit intopayloadcms:mainfrom
Open
fix: add type declarations for css export (TypeScript 6 compat)#16348andershermansen wants to merge 1 commit intopayloadcms:mainfrom
andershermansen wants to merge 1 commit intopayloadcms:mainfrom
Conversation
Contributor
Author
|
After the build of the reproduction repo with manual patching the production run |
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?
Add TypeScript type declarations for the
./csspackage export in@payloadcms/next.Why?
TypeScript 6 enables
noUncheckedSideEffectImportsby default. This causesimport '@payloadcms/next/css'— present in all three files generated bycreate-payload-app— to fail with:error TS2882: Cannot find module or type declarations for side-effect import of '@payloadcms/next/css'.
The published
./cssexport currently has notypesfield:How?
Add src/exports/css.ts as a regular TypeScript source file (consistent with all other exports so the existing build pipeline produces dist/exports/css.d.ts. Then wire the types field into both dev and publishConfig exports.
Testing:
Tested locally by copying the new files
cp ../../payload/packages/next/dist/exports/css.* node_modules/@payloadcms/next/dist/exportsand pacthing the package.json manually:
after that my test project builds fine with typescript 6.0.3
Fixes #16346