Repository navigation
Conversation
Signed-off-by: Jenny Zhu <jenny.a.zhu@gmail.com>
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
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.
Description
Consumers that write
import '@perses-dev/design-tokens/css'(or@perses-dev/components/next/css) getTS2882: Cannot find module or type declarations for side-effect importundermoduleResolution: bundler. Theexportsentries point at bare.cssfiles with no.d.ts, and a consumer-sidedeclare module '*.css'cannot match a suffix-less specifier, so every app and plugin currently has to hand-write adeclare module '@perses-dev/…/css'stub (seeui/app/src/css.d.tsin perses/perses#4804).This PR makes the packages own that declaration:
design-tokens/src/css/index.d.tsandcomponents/src/next/css/index.d.ts: emptyexport {}stubs.design-tokens/package.json:./css,./css/layers,./css/reset,./css/tokens,./css/semanticbecome{ "types": "./dist/css/index.d.ts", "default": "./dist/css/<name>.css" };build:cssalso copiessrc/css/*.d.ts.components/package.json:./next/cssand the three./next/primitives/system/*.cssentries get the same{ types, default }shape;build:next-cssalso copiessrc/next/css/*.d.ts..swcrc: exclude\.d\.ts$so swc stops compiling declaration files into emptydist/**/*.d.jsartifacts (this already happened fortheme/types/*.d.ts,next/css.d.tsandclient/src/types/globals.d.ts).Runtime resolution is unchanged: bundlers still pick
defaultand load the same CSS files. Bare entry points type-check in consumers without local stubs, while a typo such as@perses-dev/design-tokens/css/missingstill errors.Validation:
npm run build -w design-tokens -w componentsdist/css/index.d.tsanddist/next/css/index.d.tspresent, no.d.jsemittedmoduleResolution: bundler, no local stubs) importing all 5 bare entry points +system/layout.csscss/missingimport still fails with TS2882npm run lint -w design-tokens -w componentsnpm run type-check -w design-tokens -w componentsnpm run format:checkmake checklicenseScreenshots
N/A — packaging and type declarations only.
Checklist
[<catalog_entry>] <commit message>naming convention using one of thefollowing
catalog_entryvalues:FEATURE,ENHANCEMENT,BUGFIX,BREAKINGCHANGE,DOC,IGNORE.UI Changes
See e2e docs for more details. Common issues include: