Skip to content

fix: bundle TypeScript types as expected#259

Open
bltavares wants to merge 1 commit into
trailbaseio:mainfrom
bltavares:fix-typescript-typings
Open

fix: bundle TypeScript types as expected#259
bltavares wants to merge 1 commit into
trailbaseio:mainfrom
bltavares:fix-typescript-typings

Conversation

@bltavares

@bltavares bltavares commented Jul 6, 2026

Copy link
Copy Markdown

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.

Without this file, downstream clients cannot find types:

error: Lint or type issues found
× typescript(TS7016): Could not find a declaration file for module 'trailbase'. 'F:/repos/vintage/node_modules/trailbase/dist/index.js' implicitly has an 'any' type.
   ╭─[src/routes/product/[id]/+page.ts:2:29]
 2 │ import { type Client } from "trailbase";

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.
@ignatz

ignatz commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Much appreciated 🙏 . I was trying to understand what is broken so I can merge and publish this ASAP. I had quick look at the latest package:
Screenshot From 2026-07-07 17-53-11

and it seems to export the types such as aforementioned Client. Is this an issue with the published package are you doing something else to trigger the issue?

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.

2 participants