fix: bundle TypeScript types as expected#259
Open
bltavares wants to merge 1 commit into
Open
Conversation
The project is using `vite-plugin-dts` to prepare the JS/TS library for publishing functions with type annotations. The `package.json` expects a `index.d.ts` file to exist to offer types to clients. The upgrade to `vite-plugin-dts` to v5 had a breaking change on the API, which now requires `@microsoft/api-extractor` to produce a unified `index.d.ts` instead of a separate `src/*.d.ts`. To run this library, `ajv` was also required as an optional peer package (at least on Bun). The breaking change on the `vite-plugin-dts` also had some config field name changes which has adjusted. To avoid regressions, `npm run prepack` will check for the `index.d.ts` file in case there are future breaking changes.
Contributor
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.

The project is using
vite-plugin-dtsto prepare the JS/TS library forpublishing functions with type annotations. The
package.jsonexpects aindex.d.tsfile to exist to offer types to clients.The upgrade to
vite-plugin-dtsto v5 had a breaking change on the API,which now requires
@microsoft/api-extractorto produce a unifiedindex.d.tsinstead of a separatesrc/*.d.ts. To run this library,ajvwas also required as an optional peer package (at least on Bun).The breaking change on the
vite-plugin-dtsalso had some config fieldname changes which has adjusted.
To avoid regressions,
npm run prepackwill check for theindex.d.tsfile in case there are future breaking changes.
Without this file, downstream clients cannot find types: