Skip to content

Comments

Fix TS2742 error when inferring exported Config type#19707

Open
silverwind wants to merge 2 commits intotailwindlabs:mainfrom
silverwind:fix/ts2742-config-type
Open

Fix TS2742 error when inferring exported Config type#19707
silverwind wants to merge 2 commits intotailwindlabs:mainfrom
silverwind:fix/ts2742-config-type

Conversation

@silverwind
Copy link

@silverwind silverwind commented Feb 20, 2026

Change Config exports from type aliases (type Config = UserConfig) to interfaces (interface Config extends UserConfig {}) in both index.ts and compat/plugin-api.ts.

Type aliases get resolved through to UserConfig during 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 reference Config from tailwindcss directly.

Fixes #19706

🤖 Generated with Claude Code

@silverwind silverwind requested a review from a team as a code owner February 20, 2026 07:33
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>
@silverwind silverwind force-pushed the fix/ts2742-config-type branch from e75b503 to bb90c7f Compare February 20, 2026 07:34
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

The pull request changes the declaration of the Config type from a type alias to an interface in two files. Specifically, export type Config = UserConfig is replaced with export interface Config extends UserConfig {} in both packages/tailwindcss/src/compat/plugin-api.ts and packages/tailwindcss/src/index.ts. This change alters the structural representation of the exported Config type while maintaining the same type semantics through interface extension.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: converting Config from a type alias to an interface to fix the TS2742 TypeScript error.
Description check ✅ Passed The description clearly explains the technical change (type alias to interface), the rationale (preserving Config name in declaration emit), and links to the relevant issue.
Linked Issues check ✅ Passed The PR directly addresses issue #19706 by converting Config from a type alias to an interface in both index.ts and compat/plugin-api.ts, which resolves the TS2742 error caused by hashed internal type file references.
Out of Scope Changes check ✅ Passed All changes are narrowly scoped to converting Config declarations from type aliases to interfaces in the two specified files, directly addressing the linked issue with no extraneous modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@silverwind
Copy link
Author

@coderabbitai try again with latest commit.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

@silverwind: I'll review the changes with the latest commit.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TS2742: Inferred type of export cannot be named due to hashed internal type file

1 participant