fix(dts): ensure chunks conform to bundle format #1034
Merged
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.
For runs with multiple entrypoints, there will sometimes be chunks generated. Currently, the chunks generated always output .d.ts regardless of format, since that is rollup-plugin-dts's default. The prior PR fixed this for the main bundle output, but not these chunks.
In a lot of cases, this would be a non issue. However, in certain cases, a type is determined to be "internal" even though typescript can see through to the expected type. Because this file ends in
.ts
, it finds the nearest package.json to determine the module type (lets say cjs for this example). If this "internal" type is imported from another package with dual exports (say for something that's a peer dep), and then imported in application code that is another type (esm for this example), the same import is found in the two separate exports of said subpackage and may not be assignable to the same type. This is particularly noticeable with classes that have true private properties,