Skip to content

Conversation

@chazcb
Copy link
Contributor

@chazcb chazcb commented Jan 9, 2026

Summary

  • Enable TypeScript declaration file generation (.d.ts and .d.ts.map)
  • Add types field and proper exports configuration to package.json
  • Add comprehensive integration test that verifies the full packaging flow

Changes

Build Configuration

  • tsconfig.json: Added declaration: true and declarationMap: true
  • package.json: Added types field and exports field with:
    • Main entry point with proper types and import conditions
    • Wildcard "./*": "./*" to preserve backwards compatibility for deep imports

Integration Test

The new test at src/tests/typescript-declarations.test.ts validates:

  • Full packaging flow: build → npm pack → install tarball → type-check
  • Main exports: All primary exports type-check correctly
  • Deep imports: Backwards compatibility for dist/*.js imports
  • Type shapes: Classes, interfaces, and function signatures match expected types
  • Generic types: Pushable works correctly with type parameters
  • Invalid types: TypeScript correctly rejects incorrect usage

The test creates temporary TypeScript projects, installs the actual .tgz package, and runs tsc --noEmit to verify type-checking passes.

Test plan

  • npm run build generates .d.ts and .d.ts.map files in dist/
  • All 8 integration tests pass: npm run test:integration -- typescript-declarations
  • Main exports type-check correctly
  • Deep imports continue to work (no breaking change)

🤖 Generated with Claude Code

@cla-bot
Copy link

cla-bot bot commented Jan 9, 2026

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: Charles Covey-Brandt.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email [email protected]
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

- Enable declaration file generation in tsconfig.json
- Add types field and exports to package.json
- Add comprehensive integration test that verifies:
  - Full packaging flow (build → pack → install → type-check)
  - Main exports type-check correctly
  - Deep imports work (backwards compatibility)
  - Type shapes match expected interfaces
  - Generic types work correctly

The integration test simulates the real package installation experience
by creating a tarball and installing it in temporary TypeScript projects.
This ensures declaration files work correctly for package consumers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@chazcb chazcb force-pushed the add-typescript-declarations branch from 049a783 to f77f108 Compare January 9, 2026 18:25
@cla-bot
Copy link

cla-bot bot commented Jan 9, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @chazcb on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

Ensures the test always runs with a fresh build and properly validates
that declaration files are being generated, not just leftover from
previous builds.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@cla-bot
Copy link

cla-bot bot commented Jan 9, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @chazcb on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

Copy link
Member

@benbrandt benbrandt left a comment

Choose a reason for hiding this comment

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

Looks great, thanks!

@chazcb
Copy link
Contributor Author

chazcb commented Jan 15, 2026

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Jan 15, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @chazcb on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Jan 15, 2026

The cla-bot has been summoned, and re-checked this pull request!

@chazcb
Copy link
Contributor Author

chazcb commented Jan 15, 2026

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Jan 15, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @chazcb on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Jan 15, 2026

The cla-bot has been summoned, and re-checked this pull request!

@chazcb
Copy link
Contributor Author

chazcb commented Jan 15, 2026

@cla-bot check

@cla-bot cla-bot bot added the cla-signed label Jan 15, 2026
@cla-bot
Copy link

cla-bot bot commented Jan 15, 2026

The cla-bot has been summoned, and re-checked this pull request!

@benbrandt benbrandt merged commit 6572fcf into zed-industries:main Jan 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants