You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add TypeScript type declarations for the ./css package export in @payloadcms/next, porting #16348 from the 3.x branch.
TypeScript 6 enables noUncheckedSideEffectImports by default. This makes import '@payloadcms/next/css' (present in all of our examples/templates) fail with:
error TS2882: Cannot find module or type declarations for side-effect import of '@payloadcms/next/css'.
The published ./css export had no types field, so the side-effect import had nothing to resolve against.
Key Changes
Add src/exports/css.ts
A regular TypeScript source file, consistent with the other exports, so the existing build pipeline emits dist/exports/css.d.ts.
Wire types into the ./css export
Added the types condition to both the dev and publishConfig export maps in packages/next/package.json, pointing at the source declaration in dev and the built .d.ts when published.
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
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.
Overview
Add TypeScript type declarations for the
./csspackage export in@payloadcms/next, porting #16348 from the3.xbranch.TypeScript 6 enables
noUncheckedSideEffectImportsby default. This makesimport '@payloadcms/next/css'(present in all of our examples/templates) fail with:The published
./cssexport had notypesfield, so the side-effect import had nothing to resolve against.Key Changes
Add
src/exports/css.tsdist/exports/css.d.ts.Wire
typesinto the./cssexporttypescondition to both the dev andpublishConfigexport maps inpackages/next/package.json, pointing at the source declaration in dev and the built.d.tswhen published.