Publish valid ESM types for dual output packages#120
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates ts-toolkit’s packaging workflow to publish valid TypeScript declarations for dual ESM/CJS outputs and adds an arethetypeswrong export/types validation step to generated templates and this repo’s build.
Changes:
- Emit conditional
exportsentries with per-conditiontypesfor dual-output packages. - Add a build step to validate published artifacts with
@arethetypeswrong/cli(attw --pack dist), including wiring it into templates and devDependencies. - Add utilities + tests to generate
.d.mts/.d.ctssiblings and rewrite relative specifiers for ESM declaration resolution.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/util/copy-package-json-from-config.ts | Builds new exports shapes and emits dual declaration siblings with ESM-specifier rewriting. |
| src/util/copy-package-json-from-config.spec.ts | Adds tests for conditional exports shapes and declaration emission/rewriting. |
| src/init/check-packages.ts | Ensures @arethetypeswrong/cli is installed in initialized Node projects. |
| src/init/add-scripts.ts | Adds build:* script to run attw against the packed dist output in templates. |
| package.json | Bumps version and adds attw build script + devDependency. |
| package-lock.json | Locks new @arethetypeswrong/cli dependency tree and updates version metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tristanmenzel
approved these changes
Apr 24, 2026
Contributor
Author
4 tasks
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.

Problem
https://arethetypeswrong.github.io/?p=%40makerx%2Fexpress-msal%40%5E2.0.0-beta.0
More details
https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseCJS.md
Solution