fix: generate type declarations for all exports with types field#121
Merged
boazpoolman merged 2 commits intostrapi:mainfrom Apr 1, 2026
Merged
Conversation
Previously, vite-plugin-dts was only set up when a per-bundle tsconfig existed (e.g. ./admin/tsconfig.build.json or ./server/tsconfig.build.json). Custom exports like ./types silently produced no .d.ts files because their tsconfig was never generated by the init command. The fix adds a fallback chain: per-bundle tsconfig → root tsconfig.build.json → root tsconfig.json. Any export with a types field will now generate declarations as long as any tsconfig is present in the project. Also adds tsconfig files to the custom-export-plugin fixture and a test that asserts index.d.ts is produced for the ./types custom export. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: b8d289b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
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.



Summary
vite-plugin-dtswas only set up when a per-bundle tsconfig existed at a hardcoded path (e.g../admin/tsconfig.build.json,./server/tsconfig.build.json). These are auto-generated byinit, but custom exports (e.g../types) never get one, so type generation silently failed.vite-config.ts— per-bundle tsconfig → roottsconfig.build.json→ roottsconfig.json. Any export with atypesfield now generates.d.tsfiles as long as any tsconfig is present in the project.custom-export-pluginand a new assertion thatdist/types/index.d.tsis produced after building.Test plan
pnpm run test:unit— new testshould generate type declarations for custom exports with types fieldpassestypesfield and confirm.d.tsis present indist/🤖 Generated with Claude Code