Fix TS2742 error when inferring exported Config type#19707
Fix TS2742 error when inferring exported Config type#19707silverwind wants to merge 2 commits intotailwindlabs:mainfrom
Conversation
Change `Config` from a type alias to an interface so TypeScript preserves its name in declaration emit instead of resolving through to `UserConfig` in the hashed internal chunk file. Fixes tailwindlabs#19706 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e75b503 to
bb90c7f
Compare
WalkthroughThe pull request changes the declaration of the Config type from a type alias to an interface in two files. Specifically, 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai try again with latest commit. |
|
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/tailwindcss/src/index.ts`:
- Line 37: Replace the type alias export in plugin-api.ts so consumers don't get
TS2742: locate the exported symbol "Config" (currently declared as "export type
Config = UserConfig") and change it to an interface declaration that extends
UserConfig (i.e., "export interface Config extends UserConfig {}") so it matches
the fix in packages/tailwindcss/src/index.ts and avoids re-exporting a type
alias from the public plugin entry point.
- Line 37: The plugin entry's exported Config is still a type alias causing a
public API mismatch; in compat/plugin-api.ts replace the exported type alias for
Config with an exported interface (i.e., export interface Config extends
UserConfig {}) so it matches the change in packages/tailwindcss/src/index.ts and
preserves named type identity; ensure UserConfig is imported/available in
compat/plugin-api.ts and update any re-exports that reference Config to use the
new interface form.
The compat/plugin-api.ts file also exported Config as a type alias, which could cause the same TS2742 error for consumers importing from the tailwindcss/plugin entry point. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes: #15844
Fixes: #19706
Fixes: #15458
Type aliases get resolved through to
UserConfigduring declaration emit, which lives in a hashed internal DTS chunk with no stable import path, causing TS2742. Interfaces preserve their named identity, so downstream declaration files referenceConfigfromtailwindcssdirectly.🤖 Generated with Claude Code