Skip to content

fix: publish TypeScript types#13

Merged
jhnns merged 3 commits into
masterfrom
emittypes
Jun 16, 2026
Merged

fix: publish TypeScript types#13
jhnns merged 3 commits into
masterfrom
emittypes

Conversation

@salza80

@salza80 salza80 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Update the package build and publish metadata so TypeScript declarations are generated and included in the npm package.

The source exports TypeScript types, but the package did not emit or publish declaration files.

What changed

  • Added a top-level types entry pointing to dist/main.d.ts
  • Added a declaration-only TypeScript build via tsconfig.build.json
  • Updated npm run build to generate both JS bundles and .d.ts files
  • Added prepack so npm pack / npm publish build the distributable package before packaging
  • Made Error.captureStackTrace optional so generated declarations do not leak Node-only ambient types

The first declaration build also exposed @types/node through inherited Error static fields, which could break consumers that do not install Node types. The dedicated declaration build avoids that leak.

@salza80 salza80 requested a review from Copilot June 15, 2026 16:41
@salza80 salza80 self-assigned this Jun 15, 2026
@salza80 salza80 changed the title fix: fix: publish TypeScript types Jun 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the package build/publish setup to generate and ship TypeScript declaration files for the library’s public API, aligning runtime bundles (Vite) with published type definitions.

Changes:

  • Added a declaration-only TypeScript build (tsconfig.build.json) and wired it into npm run build.
  • Updated package.json to publish types via types + conditional exports, and added prepack to build before npm pack/npm publish.
  • Adjusted AbstractError to use an optional Error.captureStackTrace to avoid leaking Node-only typings into generated declarations; updated Travis CI to Node 20 and to run the build.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tsconfig.build.json Adds a dedicated declaration-only TS build configuration.
src/AbstractError.ts Makes captureStackTrace optional with explicit typing to avoid Node ambient type leakage.
package.json Publishes .d.ts via types/exports and updates build/publish lifecycle scripts.
package-lock.json Updates lockfile metadata/version as part of the release/build changes.
.travis.yml Modernizes CI to Node 20 and runs both tests and build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

Comment thread package.json
@salza80 salza80 requested a review from jhnns June 15, 2026 18:12
@jhnns jhnns merged commit 069a310 into master Jun 16, 2026
@jhnns jhnns deleted the emittypes branch June 16, 2026 11:43
@jhnns

jhnns commented Jun 16, 2026

Copy link
Copy Markdown
Member

Published as v2.0.1 🚀

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.

3 participants