Skip to content

fix(ts): type definitions are not resolvable without proper types fields in package.json#170

Merged
rvagg merged 2 commits intorvagg:masterfrom
nbbeeken:fix-type-defs
Apr 30, 2026
Merged

fix(ts): type definitions are not resolvable without proper types fields in package.json#170
rvagg merged 2 commits intorvagg:masterfrom
nbbeeken:fix-type-defs

Conversation

@nbbeeken
Copy link
Copy Markdown
Contributor

Hi! It seems like the type definitions are not importable in the current release just because of these small quirks about how you have to put the "types" fields in the package.json.

Here's a site that provides a test:

https://arethetypeswrong.github.io/?p=bl%407.0.0

@rvagg
Copy link
Copy Markdown
Owner

rvagg commented Apr 28, 2026

can you rebase onto master (tsconfig.tsbuildinfo is gone for a start) and not reorder things but just add the "types": "./types/index.d.ts", line by itself please?

@nbbeeken
Copy link
Copy Markdown
Contributor Author

nbbeeken commented Apr 28, 2026

@rvagg yes, done! (oops, followed up with the deps reorder, that was done automatically by npm on npm i)

The types line proceeding the import line is part of the fix, surprisingly, order matters (we had the same bug on bson a ways back)

here's the documentation that points out that "types" comes first had to dig it up for myself 😅

@rvagg
Copy link
Copy Markdown
Owner

rvagg commented Apr 30, 2026

The "types" condition should always come first in "exports".

🤯

thanks for this! TIL

@rvagg rvagg merged commit 22c02e6 into rvagg:master Apr 30, 2026
9 checks passed
github-actions Bot pushed a commit that referenced this pull request Apr 30, 2026
## [7.0.2](v7.0.1...v7.0.2) (2026-04-30)

### Bug Fixes

* **ts:** type definitions are not resolvable without proper types fields in package.json ([#170](#170)) ([22c02e6](22c02e6))
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 7.0.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants